C100DEV MongoDB Overview and Document Model Practice Question
A developer is designing a MongoDB collection to store sensor readings. Each reading document contains a sensorId, a timestamp, and a readings array of subdocuments with type and value fields. The application frequently queries for readings where the readings array contains a subdocument with type "temperature" and value greater than 30. Which document model feature allows the query to match elements within the array efficiently?
⚠ Common exam trap
The trap here is thinking that arrays are automatically indexed or that the _id index covers array elements, when in fact a dedicated multikey index on the array field is required.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Multikey indexes, which are created automatically when an index is built on a field that contains an array, allow the query to match individual array elements.
A multikey index is created when an index is built on a field containing an array. MongoDB generates an index entry for each array element, so queries that filter on subdocument fields within the array can use the index. This allows the sensor reading query to match temperature readings above 30 efficiently, as long as an appropriate index exists on the readings field.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Multikey indexes, which are created automatically when an index is built on a field that contains an array, allow the query to match individual array elements.
Why this is correct
When an index is created on a field that holds an array, MongoDB creates a multikey index with separate index entries for each array element. This allows queries that filter on array elements, such as readings.type and readings.value, to use the index efficiently. The server can match the specific subdocument conditions without scanning the entire collection, which fits the sensor reading scenario.
- ✗
The _id index, which is created on every collection, includes all array elements and can be used to match subdocument fields.
Why it's wrong here
The _id index is created on the _id field only and does not include other fields such as readings. It cannot be used to match subdocument fields within an array. To query array elements efficiently, a separate index on the array field is needed. This option incorrectly assumes the _id index covers all fields, which is not the case.
- ✗
Capped collections, which store documents in insertion order, automatically index array elements for fast lookups.
Why it's wrong here
Capped collections are fixed-size collections that preserve insertion order and support high-throughput writes, but they do not automatically index array elements. They still require explicit indexes for efficient queries. Using a capped collection would not provide the array element matching described in the scenario, so this option confuses collection type with index behavior.
- ✗
Array flattening, which merges all subdocuments into a single document, allows the query to treat the readings array as a flat set of fields.
Why it's wrong here
MongoDB does not flatten arrays into a single set of fields. The readings array remains an array of subdocuments, and queries must use dot notation or $elemMatch to address elements. Array flattening is not a MongoDB feature, so this option describes a behavior that does not exist and would not help with the query.
About these practice questions
Courseiva writes every C100DEV question from scratch — 259 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official MongoDB exam blueprint
This C100DEV practice question is part of Courseiva's free MongoDB certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the C100DEV exam.