Skip to content

Restore a MongoDB backup

Restore a MongoDB database backup.

This is a quick example of how to restore a MongoDB database dump.

Step 1 - Create a MongoDB database

Create a MongoDB backup for sampleDatabase (as an example).

Step 2 - Copy the backup URL

  • Go to your backup page, then select the "Logs" tab. Afterwards, click the little "( i )" on the right next to the copy you want to download.

Restore a MongoDB backup screenshot 1

  • Under the backup restore section on the modal that just popped up, click on "Click to generate a signed download link" then copy the resulting link

Step 3 - Download the backup

On your server, run the following command, and use the signed download link you obtained in the previous step (ensure you enclose it in double quotes as shown):

plain
wget "PasteTheSignedDownloadLinkHereBetweenTheQuotes" -O "mongodb-backup.bin.gz"

Step 4 - Restore your backup

Now that you downloaded the database backup on your server, restore it as shown below by running:

plain
mongorestore --gzip --archive=mongodb-backup.bin.gz --nsFrom "sampleDatabase.*" --nsTo "newDbName.*"