mongoexport --uri="mongodb://localhost:27017/appdb" --collection=users --out=users.jsonUseful for interoperability, reporting, and selective migrations.
Use mongoimport, mongoexport, bsondump, and GridFS tools for practical MongoDB data movement workflows.
Command-line tools for structured data movement.
mongoexport --uri="mongodb://localhost:27017/appdb" --collection=users --out=users.jsonUseful for interoperability, reporting, and selective migrations.
mongoexport --uri="mongodb://localhost:27017/appdb" --collection=users --type=csv --fields=name,email,created_at --out=users.csvCSV export is handy when downstream tools expect a flat tabular format.
mongoimport --uri="mongodb://localhost:27017/appdb" --collection=users --file=users.json --jsonArray`--jsonArray` is required when the source file contains one top-level JSON array.
mongoimport --uri="mongodb://localhost:27017/appdb" --collection=users --type=csv --headerline --file=users.csv`--headerline` uses the first row as field names.
bsondump dump/appdb/users.bson > users.jsonUseful when you want to inspect BSON dump content in a human-readable format.
Work with files stored in MongoDB GridFS.
mongofiles --uri="mongodb://localhost:27017/appdb" listUseful when MongoDB is being used to store large files or media via GridFS.
mongofiles --uri="mongodb://localhost:27017/appdb" put report.pdfUploads the file into GridFS collections.
mongofiles --uri="mongodb://localhost:27017/appdb" get report.pdfGood for round-trip validation and recovery tasks.