I come from a bash and mysql environment. I'm trying to get use to mongodb. I see there are different ways to export and import mongodbs. Does anyone know the bash and mongodb equivalent of

bash> mysqldump -u username -p -h localhost mydatabase> mydatabase.sql

bash> mysql -u username -p -h localhost;

mysql> create database mynewdatabase; grant all privileges on mynewdatabase.* to 'username'@'localhost' identified by 'mypass'; exit;

bash> mysql -u username -p -h localhost mynewdatabase < mydatabase.sql

1 Answer 1


Look at mongodump and mongorestore here in this tutorial in the documentation for backup and restore tools

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.