mongo 3.0 备份和还原数据库 ,及too many positional arguments错误

时间:2021-04-10 23:21:48

在mongo 3.0的操作

 

备份示例

./mongodump -h localhost -d liongo -o ./

 

错误方式:

./mongorestore -h 127.0.0.1 -d liongo --directoryperdb /home/zhoudazhuang/company-zhoudazhuang/liongo/note.bson

会报错:

2017-01-27T15:31:54.217+0800 error parsing command line options: --dbpath and related flags are not supported in 3.0 tools. See http://dochub.mongodb.org/core/tools-dbpath-deprecated for more information 2017-01-27T15:31:54.217+0800 try 'mongorestore --help' for more information

 

使用mongorestore –help,正确还原方式为(去掉–directoryperdb):

./mongorestore -h 127.0.0.1 -d liongo /home/zhoudazhuang/company-zhoudazhuang/liongo/note.bson --drop

 

   too many positional arguments错误

在window下mongodb默认安装在c盘的Program Files文件下 

           这个文件名中间有个空格    就导致了接下来too many positional arguments错误的产生