A backup is a copy of your database data saved separately. It helps you recover data if something goes wrong, like accidental deletion or hardware failure.
Click to reveal answer
beginner
Name two common backup methods in MongoDB.
1. mongodump: creates a binary export of the database. 2. File system snapshot: copies the database files directly while MongoDB is stopped or using journaling.
Click to reveal answer
intermediate
What is the role of the oplog in MongoDB backup and restore?
The oplog (operation log) records all changes to the data. It helps in point-in-time recovery by replaying changes after restoring a backup.
Click to reveal answer
beginner
How does mongorestore work?
mongorestore reads data from a mongodump backup and inserts it back into a MongoDB database, restoring collections and documents.
Click to reveal answer
intermediate
Why is it important to test your backup and restore process?
Testing ensures your backups are valid and can be restored successfully. It prevents surprises during real data loss events.
Click to reveal answer
Which MongoDB tool is used to create a binary backup of the database?
Amongodump
Bmongorestore
Cmongoexport
Dmongoshell
✗ Incorrect
mongodump creates a binary backup of the database data.
What does the oplog help with during restore?
AEncrypting data
BCompressing backup files
CDeleting old backups
DReplaying changes for point-in-time recovery
✗ Incorrect
The oplog records all changes and helps replay them to restore data to a specific point in time.
Which backup method requires stopping MongoDB or using journaling?
AFile system snapshot
Bmongodump
Cmongorestore
Dmongoexport
✗ Incorrect
File system snapshots copy database files and usually require MongoDB to be stopped or use journaling to ensure consistency.
What is the main purpose of mongorestore?
AExport data to JSON
BCreate a backup
CRestore data from a mongodump backup
DMonitor database performance
✗ Incorrect
mongorestore loads data from a mongodump backup back into MongoDB.
Why should you regularly test your backups?
ATo encrypt the data
BTo ensure backups can be restored successfully
CTo speed up the database
DTo reduce backup file size
✗ Incorrect
Testing backups confirms they are valid and can be restored when needed.
Explain the main backup strategies available in MongoDB and when you might use each.
Think about tools and how MongoDB data files can be copied safely.
You got /4 concepts.
Describe the role of the oplog in MongoDB backup and restore processes.
Consider how changes are tracked and replayed.
You got /3 concepts.
Practice
(1/5)
1. What is the primary purpose of creating backups in MongoDB?
easy
A. To protect data from loss or damage
B. To speed up database queries
C. To increase storage space
D. To improve network performance
Solution
Step 1: Understand the role of backups
Backups are copies of data saved to prevent loss in case of failure or damage.
Step 2: Identify the main goal of backups in MongoDB
MongoDB backups protect your data so you can restore it if something goes wrong.
Final Answer:
To protect data from loss or damage -> Option A
Quick Check:
Backup purpose = Protect data [OK]
Hint: Backups save data safety, not speed or space [OK]
Common Mistakes:
Confusing backups with performance improvements
Thinking backups increase storage capacity
Assuming backups speed up queries
2. Which command is used to create a backup of a MongoDB database?
easy
A. mongorestore
B. mongoload
C. mongoexport
D. mongodump
Solution
Step 1: Recall MongoDB backup commands
The command mongodump is used to create backups by dumping data.
Step 2: Differentiate from other commands
mongorestore restores data, mongoexport exports JSON/CSV, and mongoload is not a valid command.
Final Answer:
mongodump -> Option D
Quick Check:
Backup command = mongodump [OK]
Hint: Dump means backup; restore means recover [OK]
Common Mistakes:
Confusing mongodump with mongorestore
Choosing mongoexport which exports data but not backup
Selecting a non-existent command mongoload
3. What will happen if you run the command mongorestore --drop dump/?
medium
A. It creates a backup of the database in the dump folder
B. It restores data from the dump folder and drops existing data before restore
C. It exports data to JSON files in the dump folder
D. It deletes the dump folder without restoring data
Solution
Step 1: Understand the mongorestore command with --drop
mongorestore restores data from a backup. The --drop option deletes existing data before restoring.
Step 2: Analyze the command effect
Running mongorestore --drop dump/ restores data from the dump folder and removes current data first to avoid duplicates.
Final Answer:
It restores data from the dump folder and drops existing data before restore -> Option B
Quick Check:
mongorestore --drop = restore with drop [OK]
Hint: --drop means delete existing data before restore [OK]
Common Mistakes:
Thinking mongorestore creates backups
Assuming --drop deletes the backup folder
Confusing mongorestore with mongoexport
4. You ran mongodump --db mydb --out backup/ but the backup folder is empty. What is the likely mistake?
medium
A. You need to run mongorestore instead of mongodump
B. mongodump command does not support --out option
C. The database name is incorrect or does not exist
D. The backup folder must be created manually before running mongodump
Solution
Step 1: Check command syntax and options
mongodump supports --out to specify backup folder. The command syntax is correct.
Step 2: Identify common causes for empty backup
If the database name is wrong or does not exist, mongodump creates no backup files, leaving the folder empty.
Final Answer:
The database name is incorrect or does not exist -> Option C
Quick Check:
Empty backup = wrong DB name [OK]
Hint: Check database name spelling if backup folder is empty [OK]
Common Mistakes:
Thinking --out is unsupported by mongodump
Confusing mongodump with mongorestore
Assuming backup folder must exist before running command
5. You want to automate daily backups of your MongoDB database and ensure backups are tested regularly. Which strategy is best?
hard
A. Run mongodump daily via a scheduled task and periodically run mongorestore on a test server
B. Only run mongodump once and keep the backup indefinitely without testing
C. Use mongorestore daily to create backups and mongodump to test them
D. Manually copy database files every week without using mongodump or mongorestore
Solution
Step 1: Identify proper backup automation
Automating backups requires running mongodump regularly, such as daily, using scheduled tasks or cron jobs.
Step 2: Understand importance of testing backups
Regularly restoring backups on a test server with mongorestore ensures backups are valid and usable.
Final Answer:
Run mongodump daily via a scheduled task and periodically run mongorestore on a test server -> Option A
Quick Check:
Automate dump + test restore = safe backups [OK]
Hint: Automate dump daily and test restore regularly [OK]
Common Mistakes:
Not testing backups after creation
Using mongorestore to create backups
Relying on manual file copying without tools
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.