问题描述
以前,我将mongodump和mongorestore与社区版本的mlab帐户(沙盒)一起使用,数据库版本为3.6。 我注意到客户端工具已更新,我可以仅在Windows 10计算机上本地安装工具100.1.1。 使用以下命令重复使用与命令完全相同的还原:
.\mongorestore.exe /h <hostname> /port:<port> /d <dbname> /u <username> /p <pwd> /drop /dir '<path to data dump dir>'
这很有帮助;-)删除了我现有的收藏集,但未能还原其中任何一个...关键错误消息似乎是:
finished restoring <dbname>.entries (0 documents,0 failures)
Failed: <dbname>.entries: error restoring from <path to data dump dir>\entries.bson: this MongoDB deployment does not support retryable writes. Please add retryWrites=false to your connection string
我切换到/ uri格式(以便可以使用连接字符串),以告诉客户端不要使用可重试的写操作(该功能出现在版本4中,所以没有在mlab服务器上使用)。经过一番实验,我最终得到了:
.\mongorestore.exe /uri 'mongodb://<username>:<password>@<host>.mlab.com/<dbname>?retryWrites=false' /port:<hostport> /authenticationDatabase:<dbname> /drop /dir '<path to data dump dir>'
这实际上已经过身份验证,但是然后无法识别bson文件,并且目录中的每个bson文件都显示错误:
don't know what to do with file <path to data dump dir>\<collection>.bson
因此,我想我可能会缺少如何启用/使用新的mongorestore的以下选项:
- 使用非uri格式时,您不能指定retryWrites = false
- 切换到uri格式会禁用bson文件格式支持
最后,我还原了旧的3.6服务器工具目录,并以此方式进行了还原...
文档中是否缺少一个简单的开关?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)