C100DEV Indexing Practice Question
An e-commerce application frequently executes a query filtering by 'category' and 'brand', and then sorts the results by 'price' in ascending order. You created a compound index on { category: 1, brand: 1, price: 1 }. Which statement best describes how MongoDB utilizes this index for a query that filters only on 'brand' and 'price'?
⚠ Common exam trap
Candidates often mistakenly believe that an index on {a, b, c} can be used to query {b, c}, forgetting that the query must include the leading prefix of the index.
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
✓
MongoDB will perform a collection scan as the query lacks the 'category' prefix required by the index.
Compound indexes in MongoDB utilize a prefix-based matching system. To use an index for filtering or sorting, the query must include the first field of the index or a sequence of fields starting from the first. Since 'category' is the first field and is missing from the query filter, MongoDB cannot use this specific index for efficient lookups, highlighting the importance of field ordering in index design.
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 query engine will perform an index scan because 'brand' and 'price' are part of the index.
Why it's wrong here
MongoDB requires the leading field of a compound index, known as the prefix, to be present in the query to utilize the index for filtering. Without 'category', the index structure cannot be traversed efficiently, forcing the engine to ignore this index or perform an expensive full scan of all entries.
- ✓
MongoDB will perform a collection scan as the query lacks the 'category' prefix required by the index.
Why this is correct
The index prefix rule dictates that a query must use the first field of the compound index to enable an index scan. Because 'category' is omitted, the query engine cannot utilize the B-tree structure of the index for 'brand' and 'price', resulting in a full collection scan to find matching documents.
- ✗
The index will be used only for the sort operation on 'price' but not for the filter on 'brand'.
Why it's wrong here
Sorting via an index also requires the fields preceding the sort field in the index to be present as equality matches in the query. Because 'category' is not matched and 'brand' is not the primary prefix, the index cannot provide an ordered sequence for the 'price' field to avoid an in-memory sort.
- ✗
MongoDB will use the index to find 'brand' but will still need to fetch documents to verify 'price'.
Why it's wrong here
The B-tree structure of a compound index is organized primarily by the first field. If the first field is missing, the engine cannot skip to the 'brand' section of the index. Indexing strategy requires alignment between query patterns and the physical order of keys within the index to provide performance benefits.
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.