MongoDB Export cmd

Here’s is a simple MongoDB ‘mongoexport’ command syntax to backup the document/database. This command can be used to backup based on particular conditions (‘where’ clause)

Go to MongoDB bin  directory and execute as below:./mongoexport –host localhost –port 10000 -d doc_name -c coll_name -q ‘{“_id”:”12345687899asdc”}’ -o /path/file_name.csv

This will export a single record which is matching the given value for field ‘_id’.

  • Ask Question