Produce exports of data stored in a MongoDB instance formatted as JSON or CSV. More information: https://docs.mongodb.com/database-tools/mongoexport/.
stdout
, formatted as JSON:mongoexport --uri=connection_string --collection=collection_name
mongoexport --db=database_name --collection=collection_name --query="query_object" --out=path/to/file.json
mongoexport --collection=collection_name --jsonArray
mongoexport --collection=collection_name --type=csv --fields="field1,field2,..." --out=path/to/file.csv
mongoexport --collection=collection_name --type=csv --fields="field1,field2,..." --queryFile=path/to/file --noHeaderLine --out=path/to/file.csv
stdout
, formatted as human-readable JSON:mongoexport --uri=mongodb_uri --collection=collection_name --pretty
mongoexport --help