'Can i know how to import the database in mongoDB atlas?

I would like to know a suitable solution to import database in the momgoDB atlas.



Solution 1:[1]

# this cleans up the temp directory
    rm -rf /tmp/mongo-dump 

# this saves the dump of the ${db_name} database you have to the /tmp/mongo-dump directory
    mongodump --uri="mongodb+srv://${user}:${pass}@${cluster-identifier}.mongodb.net/${db_name}?retryWrites=true&w=majority" --out=/tmp/mongo-dump

# this restores the ${db_name} database from the dump you created with previous script 
    mongorestore --uri="mongodb+srv://${user}:${pass}@${another-cluter-id}.mongodb.net/${db_name}?retryWrites=true" /tmp/mongo-dump

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Filburt