How to Import and export all collections on MongoDB?

0
24

Can I Import Export all collections on MongoDB? 

The answers is YES. πŸ‘Œ

βœ‹βœ‹βœ‹βœ‹ Hello everybody, welcome to Learn Tech Tips channel, I am Zidane (chinese nick name is οΌšι›žθ›‹ πŸ₯šπŸ₯šπŸ₯šπŸ₯šπŸ₯šπŸ₯šπŸ₯šπŸ₯šοΌ‰. Nice to see you all, enjoy my technical blog

Many people when working with MongoDB but they cannot import or export data from Mongo Database,

Today I  want to share with you how to use import and export on MongoDB.

Just with simple step you can handle it and save you a lots time about import and export data on MongoDB

Let’s Follow me on

πŸ‘‰ Tiktok

πŸ‘‰ Facebook:

πŸ‘― Let’s start!!!

 Go inside below mongo link for download mongo db tools

Belongto to your environment (MacOS, Window, Linux), you can choose your fitable to download database tools

Import and export with each collections 

Export on MongoDB

Mongoexport.exe –collection=courses –db=cms_dev –out=”course.json” mongodb://localhost:27017

Import on MongoDB

Mongoimport.exe <options> <connection-string> <file>

or you can go inside the mongodb compass for import directly

Can I use Import Export all data on MongoDB?

Import and export ALL Collections 

Export all collections:

mongodump –uri β€œmongodb+srv://Admin@appcluster.15lf4.mongodb.net/urldb” -o ./backup-folder 

Example:

mongodump –uri β€œmongodb+srv://Admin:Zidane@appcluster.15lf4.mongodb.net/mytestdb” -o ./mongo-backup

Import all collections:

mongorestore <options> <connection-string> <directory or file to restore>

Example:

mongorestore β€œmongodb+srv://Admin:Zidane@appcluster.15lf4.mongodb.net/mytestdb” -./mongo-backup/

Is it easy to working with about command.

You can reference here also:  

https://www.mongodb.com/docs/database-tools/mongodump/

https://www.mongodb.com/docs/database-tools/mongorestore/

https://www.mongodb.com/docs/database-tools/mongoimport/ 

https://www.mongodb.com/docs/database-tools/mongoexport/

Thanks for reading the topic how to import and export all collections on MongoDB. Any feedback and questions. Leave your comment on below post, we can discuss about it.
βœ‹βœ‹βœ‹βœ‹ Learn Tech Tips – I am Zidane, See you next time