Mongoexport is the MongoDB command used to take the
backup of collections (tables) in JSON or CSV format. This command should be
executed from the command prompt not from the MongoDB clients.
Syntax:
1) Mongoexport
--db databasename --collection collection --out filenametosave.json
2) mongoexport
--host training.fourthbottle.com --port Portnumber --username user --password
pass --collection collectionname --db databasename --out filenametosave.json
Example
Mongoexport
–db test –collection store --out store.json
Mongoexport
–db test –collection store --out “D:\ backup\store.csv”
First
example will save the file in the root directory and second will save in
specified directory.