问题描述
我已经使用mongodump
转储了我的mongodb数据库,它在dump/mydb
I have used mongodump
to dump my database of mongodb, it created some bson files under dump/mydb
但是我不知道如何使用它们.我尝试了mongoimport
,但似乎无法导入bson数据.那么如何使用这些bson文件呢?如何将它们导入另一个mongodb?
But I don't know how to use them. I tried mongoimport
, but seems it can't import bson data. Then how to use these bson files? How to import them to another mongodb?
推荐答案
您需要使用 mongorestore ,而不是mongoimport ...,它用于导入json或csv等.
You need to use mongorestore, not mongoimport ... which is used for things like importing json, or csv, etc.
来自back-up-with-mongodump
文档:
mongodump
和mongorestore
是简单而有效的支持工具 建立和还原小型MongoDB部署,但不适合 捕获大型系统的备份.
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 的更多信息;我会看一看,因为它们非常有帮助.
You can read more about mongorestore in the docs below; I'd take a look and read up on them as they are very helpful.
http://www.mongodb.org/display/DOCS/Import + Export + Tools#ImportExportTools-mongorestore
您还可以查看 http://learnmongo.com 以获得提示和帮助!
You can also check out http://learnmongo.com for tips and help!
这篇关于如何通过mongodump使用转储的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!