Skip to content

MongoDB Backup

Back up MongoDB databases with scheduled dumps to any cloud storage provider.

SimpleBackups connects to your MongoDB instance and creates scheduled dump files using mongodump. Backups are compressed, uploaded to your chosen storage, and retained according to the policy you set. For connection method options (SSH, serverless, Docker), see the database backup overview.

Backup options

Backup user permissions

Following the principle of least privilege, create a dedicated MongoDB user with the built-in backup role rather than using an admin account. This grants exactly the permissions needed for mongodump without broader system access.

Connect to your MongoDB instance and create the backup user:

javascript
use admin
db.createUser({
  user: "backup_user",
  pwd: "strong_password",
  roles: [{ role: "backup", db: "admin" }]
})

Replace backup_user and strong_password with your chosen credentials, then use this user when configuring the backup in SimpleBackups.

Read replica connection

You can point SimpleBackups at a read replica instead of the primary to reduce load on your production database. When connecting to a MongoDB replica set, include the replicaSet and authSource parameters in your connection string:

plain
mongodb://username:password@replica-host-name/dbname?replicaSet=replica-set-name&authSource=admin

Replace username, password, replica-host-name, dbname, and replica-set-name with your actual values.

Restoring a backup

Restore a MongoDB backupHow to download and restore a MongoDB dump file using mongorestore.Restore a MongoDB Atlas collection using CompassHow to import a collection into MongoDB Atlas using the Compass GUI.