gpt4 book ai didi

json - 从 mongodump 获取 JSON 文件

转载 作者:可可西里 更新时间:2023-11-01 10:00:08 25 4
gpt4 key购买 nike

我正在尝试使用此命令导出我的一个 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com