如何通过mongodump使用转储的数据? [英] How to use the dumped data by mongodump?

查看:81
本文介绍了如何通过mongodump使用转储的数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用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从MongoDB数据库读取数据并创建高保真BSON文件,mongorestore工具可使用该文件填充MongoDB数据库.

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

mongodumpmongorestore是简单而有效的支持工具 建立和还原小型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使用转储的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆