MongoDB Questions and Answers – MongoDB documents – 2


This set of MongoDB Test focuses on “MongoDB Documents – 2”.

1. Which of the following data structures are documents in MongoDB?
a) All database records
b) Query selectors
c) Update definitions
d) All of the mentioned
View Answer

Answer: d
Explanation: Most user-accessible data structures in MongoDB are documents.

2. Point out the correct statement.
a) Update definitions define what fields to modify during an update
b) Query specifications, which define what fields to index
c) Index selectors, which define what records to select for read, update, and delete operations
d) All of the mentioned
View Answer

Answer: a
Explanation: MongoDB stores all data in documents, which are JSON-style data structures composed of field-and-value pairs.

3. An application communicates with MongoDB by way of a client library, called _____________
a) Driver
b) Parent
c) Rank
d) None of the mentioned
View Answer

Answer: a
Explanation: Driver handles all interaction with the database in a language appropriate to the application.
Note: Join free Sanfoundry classes at Telegram or Youtube

4. User-defined indexes on multiple fields is called ___________
a) composite index
b) secondary index
c) compound index
d) none of the mentioned
View Answer

Answer: c
Explanation: The order of fields listed in a compound index has significance.

5. If your driver has a version number of 2.9.1, What is the major version?
a) 1
b) 2
c) 9
d) None of the mentioned
View Answer

Answer: b
Explanation: Driver version numbers use semantic versioning or “major.minor.patch” versioning system.

Take MongoDB Practice Tests - Chapterwise!
Start the Test Now: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

6. Updates that include _________ of field names may result in the reordering of fields in the document.
a) Renaming
b) Joining
c) Nesting
d) None of the mentioned
View Answer

Answer: a
Explanation: The $rename operator updates the name of a field.

7. The $rename operator logically performs a _______ of both the old name and the new name.
a) $unset
b) $set
c) $Nested
d) None of the mentioned
View Answer

Answer: a
Explanation: If the field to rename does not exist in a document, $rename does nothing.


Sanfoundry Global Education & Learning Series – MongoDB.

Here’s the list of Best Books in MongoDB.

To practice all areas of MongoDB for various tests, Here is complete set of 1000+ Multiple Choice Questions and Answers.

Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & technical discussions at Telegram SanfoundryClasses.