mongodb - 转储和恢复 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
您需要使用nsFrom
和nsTo
。
推荐阅读
- html - 使用 nebular/auth 组件时,我的登录页面布局混乱
- javascript - _.sum(_.values(x)) ,如果 x 的值不是所有数字
- validation - 如何使用 formik 和 yup 在 react-native 中进行验证?
- django - 提取 ManyToManyField 值
- php - 如何在 Symfony 功能测试中模拟?
- datastage - 数据阶段中普通日期 (YYYY-MM-DD) 到儒略日期转换的转换
- hololens - 为 Kiosk 模式查找 Hololens 应用 AUMID
- python - 在 Windows 中执行系统调用和获取字符串响应的最快方法
- ios - iOS - 为什么苹果使用结构作为通知名称而不是字符串常量?
- python-3.x - 在 azure ML 环境中使用 xgboost