从JSON还原数据Mongodb [英] Restore data Mongodb from JSON
问题描述
我有一个转储,其中包含2个文件data.json
和metadata.json
.
我需要在本地PC上还原此数据,我尝试使用过mongorestore
工具,但对我没有帮助
I have a dump which including 2 files data.json
and metadata.json
.
I need restore this data on my local pc, I tried used mongorestore
tool, but it don't helped me
推荐答案
mongorestore 程序从二进制数据库转储中写入数据 由mongodump创建到MongoDB实例.同时, mongoimport 工具提供了从JSON,CSV或TSV导入内容的途径 由mongoexport或潜在的第三方创建的导出 导出工具.
The mongorestore program writes data from a binary database dump created by mongodump to a MongoDB instance. While, mongoimport tool provides a route to import content from a JSON, CSV, or TSV export created by mongoexport, or potentially, another third-party export tool.
您有.json文件.因此,您可以尝试mongoimport:
You have .json files. So, you can try mongoimport:
mongoimport --db <database_name> --collection <collection_name> <path to data.json>/data.json
这篇关于从JSON还原数据Mongodb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!