3 ways to export MongoDB data to files (CSV, TSV, JSON) without coding

by

Sometimes, you need to export MongoDB data to files, CSV, JSON, or other types, here are some tools you can use. All supports Atlas.

1. mongoexport, https://www.mongodb.com/docs/database-tools/mongoexport/

mongoexport is a command-line tool that produces a JSON or CSV export of data stored in a MongoDB instance.

Export JSON
mongoexport –host=”mongodb0.example.com:27017″ –collection=events –db=reporting –out=events.json

Export CSV
mongoexport –db=users –collection=contacts –type=csv –fieldFile=fields.txt –out=/opt/backups/contacts.csv

2. MongoDB Compass, https://www.mongodb.com/docs/compass/current/

MongoDB Compass is a powerful GUI for querying, aggregating, and analyzing your MongoDB data in a visual environment.
You can use MongoDB Compass to import and export data to and from collections. Compass supports import and export for both JSON and CSV files.

MongoDB Compass Export

for details: https://www.mongodb.com/docs/compass/current/import-export/

3. WithData MongoToFile, https://withdata.com/mongo-to-file/

MongoToFile is a data conversion software that helps you to export MongoDB database data to CSV (TXT), SQL, JSON, XML, html, and Excel. Support all MongoDB deployment types: standalone, replica set, sharded cluster, and MongoDB Atlas.

Export data from MongoDB Collection To File - enter file name

Export data from MongoDB Collection To File - export

For details:

Export MongoDB collection to CSV file, http://www.withdata.com/blog/mongotofile/export-mongodb-collection-to-csv-file.html

Export MongoDB collection to JSON file, http://www.withdata.com/blog/mongotofile/export-mongodb-collection-to-json-file.html

more: TSV , Excel, XML, SQL, TXT (“|” pipe delimited text), TXT (“;” semicolon delimited text)