mongodb如何仅mongodump索引到另一个mongodb实例 [英] mongodb how to mongodump only indexes to another mongodb instance
本文介绍了mongodb如何仅mongodump索引到另一个mongodb实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个包含大量数据的mongodb实例,现在我需要启动一个具有相同结构但没有数据的新实例.
I have a mongodb instance with a lot of data, now I need to start up a new instance with the same structure without data.
如何完成它?
推荐答案
您可以使用"query"选项来执行此操作,而该查询不会返回任何文档.像这样:
You can do that with the "query" option, with a query that does not return any document. Something like:
mongodump -q '{ "foo" : "bar" }'
这将转储所有数据库和索引,然后您可以进行mongorestore来将它们重新创建到另一个mongod实例中
This will dump all the dbs and indexes, you can then do a mongorestore to recreate them into another mongod instance
请参阅文档: http://docs.mongodb.org/manual/reference/program /mongodump/#cmdoption--查询
这篇关于mongodb如何仅mongodump索引到另一个mongodb实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文