MongoDB backups, every document counted

backupd runs mongodump on your schedule, adds the oplog when it can, and restores each backup into a sandbox to count every collection’s documents against the dump.

Restore test

events-2026-10-16-0300.archive.zst.age
Restorable
Collections
4 of 4
Documents
11,108,878
Took
2m 15s
Sandbox
mongodb 7.0
  1. Fetch the backup1.4 GB from storage11s
  2. DecryptUnlocked and checksum matched6s
  3. RestoreUnder a temporary prefix on the sandbox1m 48s
  4. Count documentsEvery collection matches the dump9s
  5. Clean upTemporary databases dropped1s
Counts per collection, backed up against restored
CollectionBacked upRestoredResult
events.pageviews9,812,4409,812,440match
events.sessions1,204,1181,204,118match
events.signups88,30188,301match
events.experiments4,0194,019match
4.2+
MongoDB 4.2 and later.
Oplog
Replica sets get the oplog for a consistent copy.
Exact counts
Documents counted in every collection.
Atlas ready
Atlas and self-managed, over TLS.

How a backup runs

  1. Dump with mongodumpmongodump writes one archive of your databases, with --oplog when it backs up a whole replica set.
  2. Compress and encrypt on the wayThe dump is compressed with zstd and encrypted with age as it streams to storage in 64 MiB parts. Nothing is written to a disk on the way.
  3. Check the file we storedThe stored file is read back, decrypted and decompressed, and both checksums are compared before the backup counts as good.

Backup

events-2026-10-16-0300.archive.zst.age
Succeeded
  1. Dumpmongodump --archive --oplog
  2. Compresszstd, 6.8 GB to 1.4 GB
  3. Encryptage, to 3 keys
  4. Upload23 parts of 64 MiB, nothing on disk
  5. CheckRead back, both checksums match

Took 6m 12s · Scheduled

The restore test

On your plan’s cadence, the backup is restored under a temporary prefix on a sandbox MongoDB server, without touching yours.

Every collection’s documents are counted and compared with the counts mongodump reported while it dumped. If one is short, you get an alert and the backup’s page names it. Then the copy is dropped.

How restore tests work

What backupd needs

  • A mongodb:// or mongodb+srv:// connection string. Put a database in the path to back up only that database; leave it out to back up every non-system database.
  • TLS is required: tls=true, or an +srv address.
  • Every host, including each SRV target, must resolve to a public address. Authentication is SCRAM-SHA-1 or SCRAM-SHA-256.
  • A user with the backup role, and the restore role if you restore from backupd.

Add database

backupd connects over TLS. Use a read-only user.

Connection string

mongodb+srv://backup:••••@cluster0.example.mongodb.net

Schedule

Daily at 03:00

Keep backups

30 days

CancelTest and add

Restore it yourself

Every backup is encrypted with age to your key as well as ours. Download it, and open it with free tools on your own machine:

Terminal

# Decrypt, decompress and restore
$ age -d -i backupd.agekey app.archive.zst.age | zstd -d \
  | mongorestore --archive --uri "$TARGET_URI"

# A full replica-set backup, replaying its oplog
$ age -d -i backupd.agekey app.archive.zst.age | zstd -d \
  | mongorestore --archive --oplogReplay --uri "$TARGET_URI"

Restoring without backupd

Not yet

  • The oplog is only included for full-instance dumps of a replica set. A single-database connection string, or a sharded cluster through mongos, is dumped without it.
  • The admin, config and local databases are never restored or tested.
  • Point-in-time recovery and incremental backups are not available yet; every backup is a full copy.
  • Private networks, VPC peering and SSH tunnels are not supported yet.

Questions

Yes. Use the mongodb+srv:// string Atlas gives you, and make sure Atlas’s network access list lets backupd connect.

When the connection string points at a whole replica set, mongodump runs with --oplog, so the copy is consistent to one moment. Restore it with --oplogReplay.

We restore the archive under a temporary prefix on our sandbox server, count the documents in every collection with countDocuments, compare them with what mongodump reported, then drop the copy.

Back up MongoDB tonight

Paste a connection string, pick a schedule and add your key. Starter is free for 14 days.