Backing up and restoring a mongodb to a different database

I’m using mongodb as my NoSQL database of choice for I needed a quick way to backup the mongo database to another server, and then load that production database in a test environment locally so I could do some testing.

Here is how I backed up mongodb using mongodump as described here:

First, ssh to the production database server, then use mongodump with the –db argument to specify which database to dump:

This will create a ./dump folder that you can then tar up and gzip and transfer down to your local development server.