Mongodb Certified Developer Associate C100dev · Free Practice Question Medium
Question 20
When it comes to optimizing performance in MongoDB, indexes play a crucial role. Which of the following statements about MongoDB indexing is not correct?
-
A
Creating indexes has a performance impact for write operations.
-
B
Without indexes, MongoDB must scan every document in a collection to find the documents that match each query.
-
C
MongoDB cannot use more than one index to optimize a single query.
-
D
Indexes support efficient execution of queries in MongoDB.
Reveal correct answer
Correct answer: C
A.
Creating indexes has a performance impact for write operations because each time a document is inserted or updated, the index also needs to be updated.
B.
Without indexes, MongoDB performs a collection scan, i.e., it scans every document in a collection to find the documents that satisfy the query condition.
C.
This statement is not correct. MongoDB can use more than one index for a single query. This is called a "compound index".
D.
Indexes indeed support the efficient execution of queries in MongoDB by limiting the number of documents MongoDB needs to examine during a query.
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
