mongodbMongo DB NoSQL 

How to bulk import/export data in MongoDB Atlas

Before Starting MongoDB Atlas import/Export steps, first whitelist your IP address from where you are trying to access.


In MongoDB, we use “mongodump” for exporting the existing database as a backup and we use “mongorestore” form importing the backup data back to mongo.

Mongo Atlas bulk Export all collections

To Export, you can use this below-mentioned command syntax

//Mongo Syntax

mongodump --out </path> --db <dbName> --host <hostname:portNo> --authenticationDatabase admin --ssl --username <Remote Db User> --password<Remote Db Password>

Example:

mongodump --out ~/Desktop/mongoData/ --db newdata --host cluster0-shard-01-02.xyz.mongodb.net:27017  --authenticationDatabase admin --ssl --username abc --password xyz

Mongo Atlas bulk Import all collections

To Import, you can use below mentioned command syntax

//Mongo Syntax

mongorestore </path> --db <dbName> --host <hostname:portNo> --authenticationDatabase admin --ssl --username <Remote Db User> --password<Remote Db Password>

Example:

mongorestore ~/Desktop/mongobkup/ --host cluster0-shard-00-02.xyz.mongodb.net:27017  --authenticationDatabase admin --ssl --username abc --password xyz

I hope this will help you backup and restore the remote MongoDB database for mongo Atlas
If you have any queries please leave a comment below I will reply you soon.

Also Read:  How to update nested sub-documents in Mongo DB

Related posts