mongodb - 如何使用 mongodump 转储的数据?

标签 mongodb dump mongorestore mongodump

我使用 mongodump 转储我的 mongodb 数据库,它在 dump/mydb

下创建了一些 bson 文件

但我不知道如何使用它们。我尝试了 mongoimport,但似乎无法导入 bson 数据。那么如何使用这些bson文件呢?如何将它们导入另一个 mongodb?

最佳答案

您需要使用 mongorestore,而不是用于导入 json 或 csv 等的 mongoimport ...。

来自 back-up-with-mongodump 文档:

mongodump reads data from a MongoDB database and creates high fidelity BSON files which the mongorestore tool can use to populate a MongoDB database.

mongodump and mongorestore are simple and efficient tools for backing up and restoring small MongoDB deployments, but are not ideal for capturing backups of larger systems.

您可以在下面的文档中阅读有关 mongorestore 的更多信息;我会看一下并阅读它们,因为它们非常有帮助。

http://www.mongodb.org/display/DOCS/Import+Export+Tools#ImportExportTools-mongorestore

您也可以查看http://learnmongo.com寻求提示和帮助!

关于mongodb - 如何使用 mongodump 转储的数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5495540/

相关文章:

python - 将 dict 转储到 json 时遇到问题?

mysql - 拉维尔 5 : How to dump SQL query?

mongodb - 如何恢复压缩的 Mongodb 单个集合?

mongodb - 错误 : not authorized on db to execute command

mongodb - 在本地主机上执行 mongorestore 时出现 "An existing connection was forcibly closed by the remote host"

node.js - 在 MEAN+Mongoose 堆栈中的何处加载批量数据?

mongodb - 为什么mongodb的文档中存储键名

Mysql 服务器已消失 - 在 mysqldump 期间

mongodb - 导入mongodb数据库的问题

mongodb - 谷歌应用引擎 : One To Many relations in Go