Withdata Software

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

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

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.

MongoDB Export JSON

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

MongoDB 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.

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.

Support Windows, Linux, and macOS.

Can run in GUI and CLI mode.

For details:

MongoDB Export database to CSV files

https://www.withdata.com/tools/mongodb-to-file/mongodb-to-csv

MongoDB Export database to JSON files

https://www.withdata.com/tools/mongodb-to-file/mongodb-to-json

more:
MongoDB export to TSV
MongoDB export to Excel
MongoDB export to XML
MongoDB export to SQL