0
0
MongoDBquery~10 mins

Backup and restore strategies in MongoDB - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a backup of a MongoDB database using mongodump.

MongoDB
mongodump --db [1] --out /backup/mongodump
Drag options to blanks, or click blank then click option'
Abackup
Brestore
Cmongorestore
Dmydatabase
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'restore' or 'mongorestore' instead of the database name.
Confusing backup directory with database name.
2fill in blank
medium

Complete the command to restore a MongoDB database from a backup folder using mongorestore.

MongoDB
mongorestore --db [1] /backup/mongodump/mydatabase
Drag options to blanks, or click blank then click option'
Amydatabase
Brestore
Cdump
Dbackup
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'backup' or 'restore' as database name.
Confusing folder names with database names.
3fill in blank
hard

Fix the error in the command to back up only the 'users' collection from 'mydatabase'.

MongoDB
mongodump --db mydatabase --collection [1] --out /backup/users_backup
Drag options to blanks, or click blank then click option'
Ausers
Buser
Cuser_collection
Dmydatabase
Attempts:
3 left
💡 Hint
Common Mistakes
Using singular 'user' instead of 'users'.
Using database name instead of collection name.
4fill in blank
hard

Fill both blanks to create a backup of the 'orders' collection from 'shopdb' and compress the output.

MongoDB
mongodump --db [1] --collection [2] --archive=/backup/orders.archive --gzip
Drag options to blanks, or click blank then click option'
Ashopdb
Borders
Cusers
Dbackupdb
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up database and collection names.
Using wrong collection name like 'users' instead of 'orders'.
5fill in blank
hard

Fill all three blanks to restore the 'products' collection into 'inventorydb' from a compressed archive.

MongoDB
mongorestore --db [1] --collection [2] --archive=[3] --gzip
Drag options to blanks, or click blank then click option'
Ainventorydb
Bproducts
C/backup/products.archive
Dshopdb
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong database or collection names.
Forgetting to specify the archive file path.
Not including the --gzip option for compressed archives.