我正在尝试使用此命令导出我的一个 mongo 集合:
"C:\Program Files\MongoDB\Server\3.2\bin\mongodump" -h 127.0.0.1 --port 3001 -d meteor
我有一个包含我的数据库集合的 BSON 文件,但我希望它在一个 JSON 文件中。
我该怎么做?
最佳答案
来自 the docs :
mongodump
is a utility for creating a binary export of the contents of a database--out , -o
Specifies the directory where mongodump will write BSON files for the dumped databases
所以 mongodump
输出 BSON。
如果你想输出 JSON 那么你必须使用 mongoexport
。来自 the docs :
mongoexport
is a utility that produces a JSON or CSV export of data stored in a MongoDB instance
例如:
"C:\Program Files\MongoDB\Server\3.2\bin\mongoexport" -h 127.0.0.1 --port 3001 -db <database name> --collection <collection name> --out mongo_output.json
关于json - 从 mongodump 获取 JSON 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47416179/