jiyukai

  一:MongoDB的导出功能

    mongodb提供了导入和导出的功能,分别是MongoDB下载目录下的mongoexport.exe和mongoimport.exe文件 ,具体的导出命令格式如下:    

    mongoexport -h dbhost -d dbname -c collectionName -o output

    参数说明:
    -h 数据库地址
    -d 指明使用的库
    -c 指明要导出的集合
    -o 指明要导出的文件名(文件支持多种格式,如txt,wps,xls等)

    具体示例:  

    mongoexport -h localhost:27017 -d kaiye -c c2 -o C://mongoexport/test.txt

    mongoexport -h localhost:27017 -d kaiye -c c2 -o C://mongoexport/test.wps

    mongoexport -h localhost:27017 -d kaiye -c c2 -o C://mongoexport/test.xls

  二:MongoDB的导入功能

    导入数据可以使用命令:

    mongoimport -h dbhost -d dbname -c collectionname input
    参数说明:
    -h 数据库地址
    -d 指明使用的库
    -c 指明要导入的集合(mongodb本身支持隐式创建,故事先无需创建集合)
    input 文件的地址

    具体示例:   

    mongoimport -h localhost:27017 -d kaiye -c fuck C://mongoexport/test.txt

    mongoimport -h localhost:27017 -d kaiye -c fuck1 C://mongoexport/test.wps

    mongoimport -h localhost:27017 -d kaiye -c fuck2 C://mongoexport/test.xls

    

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-22
  • 2021-06-10
  • 2021-04-03
  • 2021-10-18
  • 2021-12-25
  • 2022-12-23
猜你喜欢
  • 2021-12-20
  • 2021-07-15
  • 2021-06-13
  • 2022-12-23
  • 2022-12-23
  • 2021-11-22
相关资源
相似解决方案