Skip to content

How to BackUp a Database?

Emidio Piermarini edited this page Jan 4, 2018 · 11 revisions

WIP

The simplest way - dump:

Think of this as zipping a folder then moving it somewhere, then unzipping it somewhere else.

Step 1) Type cmd into your windows start menu to bring up the command line Step 2) Change the directory to where you'd like to dump the mongo database (see here for more info on changing directory) Step 3) Type 'mongodump'. Doing this will back up EVERYTHING in your mongo database on your local server. If you don't want to do everything and cherrypick databases and/or collections then its should be 'mongodump --db XXXXXX --collection YYYYY' where XXXXX is your preferred database name and YYYYY is your preferred collection.

This writes the 'zipped' verion of your mongo database to the dump folder:

Step 2) Move the dump folder to the new location and use the 'mongorestore' command

Clone this wiki locally