0
0
MongoDBquery~20 mins

Backup and restore strategies in MongoDB - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
MongoDB Backup Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding MongoDB Backup Types

Which of the following backup types in MongoDB allows you to capture the database state at a specific point in time without stopping the database?

ALogical backup
BCold backup
CIncremental backup
DHot backup
Attempts:
2 left
💡 Hint

Think about backups that do not require shutting down the database.

query_result
intermediate
2:00remaining
Result of mongodump Command

What is the expected output when running the command mongodump --db mydb --out /backup/?

AA directory named 'mydb' inside '/backup/' containing BSON data files
BA single JSON file named 'mydb.json' inside '/backup/'
CA compressed archive file named 'mydb.archive' inside '/backup/'
DAn error because --out requires a file name, not a directory
Attempts:
2 left
💡 Hint

Consider how mongodump organizes data when backing up a database.

📝 Syntax
advanced
2:00remaining
Correct mongorestore Syntax

Which of the following commands correctly restores a MongoDB database from a backup directory named '/backup/mydb'?

Amongorestore --restore-db mydb /backup/mydb
Bmongorestore /backup/mydb --db=mydb
Cmongorestore --db mydb /backup/mydb
Dmongorestore --database mydb /backup/mydb
Attempts:
2 left
💡 Hint

Check the official mongorestore syntax for specifying the database and source directory.

optimization
advanced
2:00remaining
Optimizing Backup Speed

You want to speed up the backup process of a large MongoDB database using mongodump. Which option will help achieve this?

AUse --numParallelCollections to dump multiple collections at once
BUse --gzip to compress data during dump
CUse --oplog to include the oplog in the dump
DUse --query to dump only a subset of documents
Attempts:
2 left
💡 Hint

Think about parallelizing work to improve speed.

🔧 Debug
expert
2:00remaining
Troubleshooting mongorestore Failure

You run mongorestore --db mydb /backup/mydb but get an error: Failed: error reading collection data. What is the most likely cause?

AThe MongoDB server is not running
BThe backup was created with --gzip but mongorestore is not using --gzip
CThe mongorestore command is missing the --drop option
DThe backup directory '/backup/mydb' does not contain BSON files
Attempts:
2 left
💡 Hint

Consider if the backup files are compressed and how mongorestore handles them.