How to backup and restore MongoDB database

Restore MongoDB
Restore MongoDB

Backup and Restore MongoDB Database

This post explains how to backup and restore MongoDB database. First, check the databases in MongoDB.

Login to the MongoDB console using the following command:


Once logged into it, run:

show dbs

It will list all MongoDB databases.

Backup a MongoDB Database

Then you can backup the desired MongoDB databases using mongodump command:

mkdir /mongobackup
mongodump --db <DB Name> --out /mongobackup `date +"%m-%d-%y"`

Restore a MongoDB Database

You can restore the MongoDB Database using mongorestore command:

mongorestore --db <DB Name> --drop /mongobackup/<Date>/<DB Name>/

That’s it!

Also, you can find the MongoDB installation from Here

If you like this post and wish to receive more articles from us, please like our FB page: Grepitout

Your suggestions and feedbacks will encourage us and help to improve further, please feel free to write your comments.

For more details on our services, please drop us an E-mail at