LearnAI ToolsCareerPractice BuildsPlayContact
Lesson 4214 min read

Backup & Restore

Protect your data with mongodump/mongorestore, and understand Atlas's automated backup and point-in-time recovery.

mongodump and mongorestore

mongodump exports a database (or an entire deployment) to a binary format on disk; mongorestore imports that data back in — the fundamental command-line backup tools that work with any MongoDB deployment, Atlas or self-managed.

mongodump --uri="mongodb+srv://user:pass@cluster0.abcde.mongodb.net/myapp" --out=./backup
mongorestore --uri="mongodb+srv://user:pass@cluster0.abcde.mongodb.net/myapp" ./backup/myapp

Backing Up a Single Collection

mongodump --uri="..." --collection=users --out=./backup

Atlas Automated Backups

MongoDB Atlas offers automated, scheduled backups (on paid tiers) that require no manual mongodump commands — snapshots are taken on a configurable schedule and retained for a configurable period, restorable through the Atlas UI directly.

Scheduled Snapshots

Automatic, configurable backup snapshots with no manual scripting.

🕰️

Point-in-Time Recovery

Restore to any specific moment, not just the last snapshot.

One-Click Restore

Restore directly through the Atlas dashboard, without command-line tools.

Point-in-Time Recovery

Point-in-time recovery uses the oplog (the same replication log covered in the replication lesson) to restore a database to any specific moment — not just whenever the last scheduled snapshot happened — invaluable for recovering from something like an accidental deleteMany({}) a few minutes after it occurred.

Test Your Restores

A backup you've never actually restored from is an untested assumption, not a real safety net — periodically verify that a restore actually works and produces usable data.

FAQs

The M0 free tier does not include automated backups — that's a paid-tier feature; for the free tier, periodic manual mongodump exports are the available option.

Yes, though for a very large or high-write database, it can add noticeable load — Atlas's built-in snapshot-based backups avoid this concern entirely.

Summary

mongodump/mongorestore cover manual backups anywhere, while Atlas's automated snapshots and point-in-time recovery remove the operational burden on paid tiers. Next, you'll deploy a production MongoDB Atlas cluster end to end.

Next Lesson →

Deploying with MongoDB Atlas