Mongo Backup and Restore

While working on Sitecore at times one can come across a simple task for backing up and restoring mongo databases. Did that made you think? Why me? It should have been done by a DBA. Let’s ignore Mr. Anger from your Inside Out and learn how to do that.

Mad at Mongo

To me the task seemed simple and my initial thoughts were let’s get connected to RoboMongo or Mongo Management Studio, visit any one menu or right click on any one of the mongo database and I will find an option to backup my databases. Well reality is always bitter and I did not have those easy options. At this point of time I was Sad from Inside Out.

Do not know Mongo Backup & Restore

I learned some commands from “Back Up and Restore with MongoDB Tools” and would like to share.

Run the command prompt as administrator and navigate to Mongo/Bin folder in my case the path was C:\Databases\Mongo26\bin. From the command prompt issue below commands,


1) Backup all databases on the Mongo Instance



This command will be backup all the databases available on the mongo instance. The backup files will be created under \bin\dump folder


2) Specific Database

mongodump --db speakplay_analytics --out c:/Backup/dump/speakplay_analytics
Parameter Description
–db Path of the database for which you want to create a backup
–out Destination path of the backup

Mongo specific database

3) Specific Database behind authentication

mongodump.exe --db sc8prod_analytics --authenticationDatabase admin --username xxxx --password xxxx --out F:\MongoBackup\sc8prod_analytics

In case if authentication is enabled extra parameters needs to be passed on to mongodump command,

Parameter Description
–authenticationDatabase DB in which the user is defined, mostly it would be “admin” database
–username Self explanatory
–password Self explanatory


4) Specific Collection

mongodump  --db speakplay_analytics --collection Interactions

If you want to restore specific collection (table) from a mongo db use –collection parameter to do so.


1) Restore a database

mongorestore --db speakplay_analytics dump/speakplay_analytics/Interactions.bson

2) Restore a collection

mongorestore --collection Interactions --db speakplay_analytics dump/speakplay_analytics/Interactions.bson

This now makes me Joy from Inside Out as I now know Mongo basics.

Happy now

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at

Up ↑

%d bloggers like this: