首页 > 解决方案 > 转储和恢复 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,然后我得到验证失败。

标签: mongodbmongodumpmongorestore

解决方案


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

您需要使用nsFromnsTo


推荐阅读