Table of contents
Overview
In this unit, you will install a set of command-line tools on an Ubuntu Linux container that will help you with several tasks associated with administering and managing a MongoDB deployment. These common tasks for DBAs include:
Backup and recovery of simple, non-sharded deployments with
mongodump
andmongorestore
Data migration with
mongoexport
andmongoimport
Deployment monitoring with
mongostat
,mongotop
, andbsondump
File storage in a MongoDB database with
mongofiles
Lesson 1 – Get Started with DBA Tools
Which of the following statements are true about the MongoDB Database Tools suite? (Select all that apply.)
A. To gain access to the MongoDB Database Tools suite, the package must be installed separately from MongoDB Community Edition or MongoDB Enterprise Edition.
B. MongoDB Database Tools are a suite of command-line utilities for working with MongoDB.
C. MongoDB Database Tools allow you to import and export data, restore backups, and view diagnostics for your deployments.
D. Version compatibility between MongoDB Database Tools and the target MongoDB server is crucial to ensure interoperability and data integrity.
Which of the following is an example of a task that can be accomplished with the MongoDB Database Tools? (Select all that apply.)
A. Importing JSON files from an external source into an Atlas cluster
B. Monitoring the status of a self-managed MongoDB deployment from the MongoDB Shell
C. Creating a backup of a small Atlas cluster
D. Diagnosing problems when attempting to restore data from a BSON file to a self-managed MongoDB deployment
Lesson 2 – Backup Tools
Which of the following best describes the MongoDB Database Tool
mongodump
? (Select one.)A. mongodump is a utility that is used to back up the contents of a sharded MongoDB cluster.
B. mongodump is a utility that is used to restore the contents of a sharded MongoDB cluster.
C. mongodump is a utility that is used to back up the contents of a simple MongoDB cluster.
D. mongodump is a utility that is used to restore the contents of a simple MongoDB cluster.
Which of the following commands will back up only the
grades
collection from thesample_training
database in adump
directory? (Select all that apply.)Option A.
mongodump --db sample_training --collection grades
Option B.
mongodump --collection grades "mongodb+srv://dbaTestAdmin@m0-example-cluster.iy0a1o4.mongodb.net/sample_training"
Option C.
mongodump -v --gzip --archive=backup.gz "mongodb+srv://dbaTestAdmin@m0-example-cluster.iy0a1o4.mongodb.net/sample_training"
Option D.
mongodump --db sample_training
A. Option A
B. Option B
C. Option C
D. Option D
Lesson 3 – Restore Tools
Which of the following best describes the MongoDB Database Tool
mongorestore
? (Select one.)A. mongorestore is a utility that is used to back up the contents of a sharded MongoDB cluster.
B. mongorestore is a utility that is used to restore the contents of a sharded MongoDB cluster.
C. mongorestore is a utility that is used to back up the contents of a simple MongoDB cluster.
D. mongorestore is a utility that is used to restore the contents of a simple MongoDB cluster.
Which of the following commands will restore only the
grades
collection from thesample_training
database from adump
directory? (Select all that apply.)Option A.
mongorestore --nsInclude=grades dump/
Option B.
mongorestore --nsInclude=sample_training.grades dump/sample_training/school/grades
Option C.
mongorestore --nsInclude=sample_training.grades dump/
Option D.
mongorestore --db sample_training –collection grades
A. Option A
B. Option B
C. Option C
D. Option D
Lesson 4 – Data Export Tools
Which of the following best describes the MongoDB Database Tool
mongoexport
? (Select one.)A. mongoexport is a command-line tool that produces a binary dump of data stored in a MongoDB instance.
B. mongoexport is a command-line tool that takes a JSON or CSV file and uploads it to a MongoDB instance.
C. mongoexport is a command-line tool that produces a YAML export of data stored in a MongoDB instance.
D. mongoexport is a command-line tool that produces a JSON or CSV export of data stored in a MongoDB instance.
Which of the following commands will export only the
grades
collection from thesample_training
database in a dump directory? (Select all that apply.)Option A.
mongoexport --collection=grades --db=sample_training --out=grades.json
Option B.
mongoexport --ns=sample_training.grades --out=grades.json
Option C.
mongoexport --collection=grades --db=sample_training --out=grades.yaml
Option D.
mongoexport --db=sample_training --out=grades.json
A. Option A
B. Option B
C. Option C
D. Option D
Lesson 5 – Data Import Tools
Which of the following best describes the MongoDB Database Tool
mongoimport
? (Select all that apply.)A. mongoimport is a command-line tool that is used to create a new database with a JSON or CSV file of data from another database.
B. mongoimport is a command-line tool that is used to restore the contents of a database with a JSON or CSV file of data from a database.
C. mongoimport is a command-line tool that is used to directly connect two databases together and have them share data.
D. mongoimport is a command-line tool that produces a JSON or CSV export of data that’s stored in a MongoDB instance.
Which of the following commands will import data to a collection called
grades
in thestudents
database from a file namedgrades.json
, and replace documents in the database that match the documents in the import file? (Select one.)Option A.
mongoimport --collection=grades --db=students --file=grades.json
Option B.
mongoimport --collection=grades --db=students --mode=delete --file=grades.json
Option C.
mongoimport --collection=grades --db=students --mode=upsert --file=grades.json
Option D.
mongoimport --collection=grades --db=students --mode=merge --file=grades.json
A. Option A
B. Option B
C. Option C
D. Option D
Lesson 6 – Diagnostic Tools: mongostat
Which of the following best describes the MongoDB Database Tool
mongostat
? (Select one.)A. mongostat is a diagnostic tool that provides a day-old view of a currently running MongoDB instance.
B. mongostat is a diagnostic tool that provides a real-time view of a currently running MongoDB instance.
C. mongostat is a diagnostic tool that provides a list of all MongoDB instances that are running on your local machine.
D. mongostat is a diagnostic tool that provides a history of all actions performed in a cluster.
Which of the following commands will show the status of the insert rate, query rate, and command rate of the MongoDB instance running at
mongodb+srv://
username@businesscluster.iy0a1o4.mongodb.net
with a polling time of 2 seconds? (Select one.)Option A.
mongostat -o='host,opcounters.insert.rate()=Insert Rate,opcounters.query.rate()=Query Rate,opcounters.command.rate()=Command Rate' "mongodb+srv://username@businesscluster.iy0a1o4.mongodb.net" 2
Option B.
mongostat -o='host,opcounters.insert.rate()=Insert Rate,opcounters.query.rate()=Query Rate,opcounters.command.rate()=Command Rate' "mongodb+srv://username@businesscluster.iy0a1o4.mongodb.net" 2000
Option C.
mongostatus -stats='host,opcounters.insert.rate()=Insert Rate,opcounters.query.rate()=Query Rate' "mongodb+srv://username@businesscluster.iy0a1o4.mongodb.net" 2
Option D.
mongostat -stats='host,opcounters.insert.rate()=Insert Rate,opcounters.query.rate()=Query Rate,opcounters.command.rate()=Command Rate' "mongodb+srv://username@businesscluster.iy0a1o4.mongodb.net" 2
A. Option A
B. Option B
C. Option C
D. Option D
Lesson 7 – Diagnostic Tools: mongotop
Which of the following best describes the MongoDB Database Tool
mongotop
? (Select one.)A. mongotop provides a method to track the amount of time a MongoDB instance spends writing data, but it does not provide information about time spent reading data.
B. mongotop is a utility that tracks the database users who spend the most time modifying the data.
C. mongotop provides a method to track the amount of time a MongoDB instance spends reading and writing data.
D. mongotop is a utility to track the amount of space left in a MongoDB instance running on Atlas.
Which of the following commands will show the read and write activity of ar MongoDB instance at
mongodb+srv://
username@businesscluster.iy0a1o4.mongodb.net
every 30 seconds? (Select one.)Option A.
mongotop 30000 --uri='mongodb+srv://username@businesscluster.iy0a1o4.mongodb.net'
Option B.
mongotop 30 --uri='mongodb+srv://username@businesscluster.iy0a1o4.mongodb.net'
Option C.
mongotop -–int=30
Option D.
mongotop 30 --database='mongodb+srv://username@businesscluster.iy0a1o4.mongodb.net'
A. Option A
B. Option B
C. Option C
D. Option D
Lesson 8 – Diagnostic Tools: bsondump
Which of the following best describes the MongoDB Database Tool
bsondump
? (Select one.)A. bsondump converts the JSON from the mongodump command into a binary format for storage efficiency.
B. bsondump outputs the entire database in binary format in the MongoDB Shell.
C. bsondump encrypts BSON files for storage on less secure servers.
D. bsondump converts BSON files into human-readable formats, including JSON.
Which of the following commands will output a prettified JSON file from the
grades.bson
file? (Select one.)Option A.
bsondump --outFile=grades.json -–pretty grades.bson
Option B.
bsondump grades.bson->grades.json -–pretty
Option C.
bsondump --inputFile=grades.bson --outputFile=grades.json -–pretty
Option D.
bsondump --outFile=grades.json grades.bson
A. Option A
B. Option B
C. Option C
D. Option D
Lesson 9 – MongoDB as a Filesystem
Which of the following best describes the MongoDB Database Tool
mongofiles
? (Select one.)A. mongofiles enables you to store BSON documents in a human-readable format instead of binary.
B. mongofiles enables you to manipulate files stored in your MongoDB instance in GridFS objects from the command line.
C. mongofiles enables you to manipulate files stored in your MongoDB instance in the Atlas UI.
D. mongofiles enables you to run diagnostics on files stored in your MongoDB instance to find any documents that do not match the schema.
Which of the following commands will list all of the files in the GridFS collection in the
grades
database that start with the word "final"? (Select one.)Option A.
mongofiles -d=grades list final
Option B.
mongofiles -d=grades list --files="final"
Option C.
mongofiles -d=grades search final
Option D.
mongofiles -d=grades put final
A. Option A
B. Option B
C. Option C
D. Option D