Preparing to build a career in MongoDB? This MongoDB MCQs collection is designed to help you test your knowledge of MongoDB concepts, queries, indexing, aggregation, replication, sharding, security, transactions, and practical database development.
Note: Score 60% or higher to unlock an exclusive offer of up to 50% off on all of our self-paced MongoDB courses.
Let's begin!
1. What type of database is MongoDB?
2. How is a MongoDB record primarily represented?
3. Which format is closely associated with MongoDB documents for data representation?
4. What is the MongoDB equivalent of a relational database?
5. What is the MongoDB equivalent of a relational table?
6. What is the MongoDB equivalent of a relational row?
7. What is the MongoDB equivalent of a relational column?
8. Which feature allows MongoDB documents in the same collection to have different fields?
9. What uniquely identifies a document by default in MongoDB?
10. What data type does MongoDB commonly generate for an automatic _id value?
11. Which method inserts a single document into a collection?
12. Which method inserts multiple documents?
13. Which method retrieves a single matching document?
14. What does find() return when used on a collection?
15. Which method updates one matching document?
16. Which method updates all documents matching a filter?
17. Which method replaces an entire matching document?
18. Which method deletes one matching document?
19. Which method deletes all matching documents?
20. Which operator increments a numeric field?
21. Which operator matches documents where a field equals any value in an array?
22. Which operator matches documents where a field does not equal any listed value?
23. Which operator performs a comparison greater than a specified value?
24. Which operator performs a less-than comparison?
25. Which operator combines multiple expressions with logical AND semantics?
26. Which operator combines expressions so that at least one must match?
27. Which operator negates the effect of another query operator or expression?
28. What does a projection control in a MongoDB query?
29. Which projection excludes a field from the returned document?
30. Which operator matches a field against a regular expression?
31. What is the main purpose of an index in MongoDB?
32. Which method creates an index?
33. What kind of index is created by {name: 1}?
34. What does a compound index contain?
35. Why does field order matter in a compound index?
36. What is a unique index used for?
37. What is a sparse index designed to do?
38. What is a TTL index commonly used for?
39. Which index type is intended for full-text search over string content?
40. What is the purpose of explain() in MongoDB?
41. What is the MongoDB aggregation framework primarily used for?
42. Which aggregation stage filters documents?
43. Which stage groups documents by an expression?
44. Which stage sorts documents?
45. Which stage limits the number of documents passed onward?
46. Which stage skips a specified number of documents?
47. Which stage reshapes documents by selecting or computing fields?
48. Which accumulator counts documents in a group?
49. Which accumulator calculates the average of values?
50. Which stage can join documents from another collection?
51. What is embedding in MongoDB data modeling?
52. What is referencing in MongoDB?
53. When is embedding often useful?
54. What is a potential problem with unbounded arrays in documents?
55. What is denormalization in MongoDB commonly used to achieve?
56. Which limit is important when designing MongoDB documents?
57. What should primarily guide MongoDB schema design?
58. Why might referencing be preferred over embedding for large related datasets?
59. What is a polymorphic schema pattern?
60. What is the bucket pattern useful for?
61. What is a replica set in MongoDB?
62. What is the primary's main role in a replica set?
63. What happens if a replica-set primary becomes unavailable?
64. What is a secondary member?
65. What is replication mainly used to improve?
66. What is an election in a replica set?
67. What is the oplog?
68. Which member can be configured with priority 0?
69. What is a hidden replica-set member commonly used for?
70. What is a delayed replica-set member designed to maintain?
71. What is sharding in MongoDB?
72. What is a shard key?
73. Why is shard-key selection important?
74. What does a mongos process do in a sharded cluster?
75. What role does config server data play in a sharded cluster?
76. What is a chunk in MongoDB sharding terminology?
77. What is a hotspot in a sharded cluster?
78. What is a targeted query in a sharded cluster?
79. What is a scatter-gather query?
80. Which topology is commonly used to provide high availability for each shard?
81. What does a MongoDB single-document write provide?
82. What is a multi-document transaction used for?
83. Which API pattern is commonly used to run a transaction in drivers?
84. What must generally happen for a transaction to be completed successfully?
85. What does aborting a transaction do?
86. Why should transactions generally be kept short?
87. What is write concern used to control?
88. What does read concern influence?
89. What is optimistic concurrency control commonly concerned with?
90. What is retryable write support intended to help with?
91. Which command is commonly used to create a MongoDB user?
92. What does authentication verify?
93. What does authorization determine?
94. Which authorization approach is central to MongoDB access control?
95. What is least privilege?
96. What does TLS primarily protect?
97. What is encryption at rest intended to protect?
98. Why should MongoDB not be exposed unnecessarily to the public internet?
99. What is auditing used for in a database environment?
100. What is client-side field-level encryption designed to provide?
101. What is a common first step when diagnosing a slow MongoDB query?
102. What is a collection scan?
103. Why can an appropriate index reduce query latency?
104. What does selectivity generally describe for an index predicate?
105. What is a covered query?
106. What does the ESR guideline commonly refer to when designing compound indexes?
107. Why can too many indexes hurt write performance?
108. What is a hint() used for?
109. What is query shape?
110. Why should schema and indexes be evaluated together?
111. What is mongodump primarily used for?
112. What is mongorestore used for?
113. What is point-in-time recovery intended to provide?
114. Why are backups tested by restoring them?
115. What is an oplog-based backup strategy useful for?
116. What does monitoring help database administrators identify?
117. Which MongoDB tool is commonly used as a command-line shell for interacting with databases?
118. What is the purpose of log messages in MongoDB operations?
119. What is capacity planning concerned with?
120. Why is replica-set health monitoring important?
121. What is a change stream used for?
122. Which MongoDB feature can expose inserts, updates, and deletes as events to applications?
123. What is GridFS designed to handle?
124. What are GridFS files divided into?
125. What is a wildcard index useful for?
126. What is a partial index?
127. What does collation control in MongoDB operations?
128. What is a time series collection optimized for?
129. What is a vector search workload typically concerned with?
130. What is Atlas Search primarily intended to provide?
131. Which driver component converts application objects into MongoDB-compatible BSON representations?
132. Why are connection pooling settings important in applications?
133. What is a cursor in MongoDB application development?
134. Why should applications avoid loading an unnecessarily large result set into memory?
135. What does pagination help control?
136. What is the purpose of schema validation?
137. Which MongoDB mechanism can validate documents against JSON Schema rules?
138. What is bulkWrite() useful for?
139. Why can projection improve application performance?
140. What is connection-string configuration used for?
141. An application frequently queries users by email. What is generally appropriate?
142. A product catalog query filters by category and sorts by price. What should you evaluate?
143. An events collection grows continuously and old records should expire automatically. Which feature fits?
144. A dashboard needs totals grouped by region. Which MongoDB feature is most suitable?
145. An application needs to react immediately when an order changes. Which feature can provide database change events?
146. A collection contains large media files that exceed the BSON document size limit. What should be considered?
147. A query unexpectedly examines a large number of documents. What should you inspect first?
148. A secondary member is receiving replication data but should never become primary. Which setting is relevant?
149. An application needs atomic changes to several documents. Which feature should be evaluated?
150. A sharded cluster has most writes landing on one shard. What is a likely concern?