1.连接数据库:(我的数据库是在F盘下,名字为:mongodb)

mongoexport导出mongodb数据库中的数据

2.打开另一个cmd,切换到bin目录下输入mongoexport -d twmovie -c categories -o F:\expressdemo\movie\db\categories.json --type=json 就可以了,这样就可以把数据导出来,形式是json

mongoexport导出mongodb数据库中的数据

3.导入json文件到mongodb,同样要先开启服务,然后切换到bin下输入命令mongoimport --db twmovie --collection users --file F:\expressdemo\movie\db\users.json --type=json

 mongoexport导出mongodb数据库中的数据

 

相关文章:

  • 2022-12-23
  • 2021-11-23
  • 2021-08-07
  • 2021-07-01
  • 2021-09-26
  • 2021-10-10
  • 2021-05-12
  • 2021-08-03
猜你喜欢
  • 2021-06-28
  • 2022-12-23
  • 2022-01-11
  • 2021-11-12
  • 2022-12-23
相关资源
相似解决方案