我使用 mongodump
转储我的 mongodb 数据库,它在 dump/mydb
但我不知道如何使用它们。我尝试了 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 themongorestore
tool can use to populate a MongoDB database.
mongodump
andmongorestore
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/