C100DEV Indexing Practice Question
A developer is working with a MongoDB collection that stores sensor readings. Each document has a 'sensorId' field and a 'readings' array containing numeric values. The developer creates an index on the 'readings' field. Which statement best describes the resulting index?
⚠ Common exam trap
The trap here is assuming that an array field is indexed as a single unit, when MongoDB actually creates multiple index keys per document for array elements.
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
✓
The index is a multikey index, and it contains an entry for each element in the readings array across all documents.
Indexing a field that holds an array causes MongoDB to create a multikey index, which stores one index entry for each element of the array in every document. This enables efficient queries that match individual array elements. The other options incorrectly describe the index structure or claim unsupported behavior. Understanding multikey indexes is fundamental for querying arrays efficiently.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The index stores a single entry per document representing the entire array, similar to a composite value.
Why it's wrong here
MongoDB does not store the array as a single composite value in a standard index. Instead, it creates a multikey index with one index key per array element. This allows queries like { readings: 42 } to use the index to find documents containing 42 in the array. Storing the whole array as one entry would prevent such element-level lookups and is not how MongoDB indexes arrays.
- ✓
The index is a multikey index, and it contains an entry for each element in the readings array across all documents.
Why this is correct
When you index a field that contains an array, MongoDB automatically creates a multikey index. For each document, the index stores a separate entry for every element in the array, allowing queries that match individual array elements to use the index. This is the defining behavior of multikey indexes and is essential for efficient array queries.
- ✗
The index is a sparse index automatically, excluding documents where the readings array is empty.
Why it's wrong here
Indexes on array fields are not automatically sparse. A sparse index only includes documents that contain the indexed field, but an empty array is still considered a value for the field. By default, MongoDB indexes documents with empty arrays as having a null-like entry, depending on version, but it does not automatically make the index sparse. Sparse behavior must be explicitly specified.
- ✗
The index cannot be created because indexing an array field is not supported in MongoDB.
Why it's wrong here
MongoDB fully supports indexing array fields; such indexes are called multikey indexes. They are commonly used for tags, arrays of identifiers, and numeric readings. The only restrictions are that you cannot create a compound multikey index with more than one array field, and certain index types like text or geospatial have their own rules. A simple index on an array field is valid.
About these practice questions
One of 259 original C100DEV practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.