I am newbie to the
Mongo.Before this I have worked only with
MySQL.In MySQL we can
export database easily.I want to know is there any option available in
import and export database easily.Any help and suggestions will be highly appreciable.
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
If you look inside mongodb/bin folder (
The mongoDB has import and export tools.
If you're running mongod locally on the default port, you can just do:
Example: Dumping Everything
Example: Dumping a Single Collection
mongoexport, mongoimport, mongorestore, bsondump etc.
You can use something like this to export:
And to import, just run:
It is important to remember that mongorestore just insert new documents, but does not update or delete the old ones. If you want to discard your database, you need to use the --drop:
This is how I export and import databases like MySQL.
You can learn more about mongodump and mongorestore here: