转储和还原mongo数据库的问题

问题描述

我这样在本地转存mongo数据库

./mongodump -h <url>:<port> -d <dbname> -u <user> -p <password> -o C:\Users\Manuel\Documents\database 

然后我尝试将其还原到另一个数据库中,例如:

./mongodump -h <otherUrl>:<otherPort> -d <otherdbname> -u <otherUser> -p <otherPassword> -o C:\Users\Manuel\Documents\database

但是我得到以下信息:

finished restoring <dbname>.<oneCollection> (0 documents,0 failures)
Failed: <dbname>.<oneCollection> : error restoring from C:\Users\Manuel\Documents\database\<dbname>\<oneCollection>.bson: this MongoDB deployment does not support retryable writes. Please add retryWrites=false to your connection string
0 document(s) restored successfully. 0 document(s) Failed to restore.

我在做什么错?如何添加retryWritables,还尝试使用--uri,然后身份验证失败。

解决方法

我觉得这是您寻求的答案:Mongorestore to a different database

您需要使用nsFromnsTo