Write documents to a JSON file.
Section: Import and export data
Export a collection to JSON
bash
bash
mongoexport --uri="mongodb://localhost:27017/appdb" --collection=users --out=users.jsonExplanation
Useful for interoperability, reporting, and selective migrations.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Import and export data