I'm trying to export one of my mongo collections using this command:
"C:\Program Files\MongoDB\Server\3.2\bin\mongodump" -h 127.0.0.1 --port 3001 -d meteor
I have a BSON file with my db collection but i want it in a JSON file.
How can I do it?
I'm trying to export one of my mongo collections using this command:
"C:\Program Files\MongoDB\Server\3.2\bin\mongodump" -h 127.0.0.1 --port 3001 -d meteor
I have a BSON file with my db collection but i want it in a JSON file.
How can I do it?
From 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
So mongodump
outputs BSON.
If you want to output JSON then you have to use mongoexport
. From the docs:
mongoexport
is a utility that produces a JSON or CSV export of data stored in a MongoDB instance
For example:
"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
© 2022 - 2024 — McMap. All rights reserved.