C100DBA Indexing and Performance Practice Question
A DBA needs to optimize a query that filters on a field with high cardinality, such as email, and also sorts on a low cardinality field, such as country. The query is { email: "user@example.com" } with sort { country: 1 }. Which index would best support this query?
⚠ Common exam trap
The trap here is thinking that the sort field should be first in the index, but with an equality filter on a high-cardinality field, the equality field should lead.
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
✓
{ email: 1, country: 1 }
The compound index { email: 1, country: 1 } is optimal because it allows an equality match on email, which is highly selective, and then provides sorted results by country. The index order matches the query pattern: equality first, then sort. This avoids an in-memory sort and minimizes the number of documents examined.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
{ email: 1 }
Why it's wrong here
A single-field index on email can filter efficiently, but it does not include country, so the sort on country would require an in-memory sort. This is less efficient than a compound index that includes the sort field.
- ✗
{ country: 1 }
Why it's wrong here
An index on country alone does not help filter by email. The query would need to scan all documents or use a collection scan, and the sort on country might be satisfied but the filtering would be inefficient. This index is not optimal for the query.
- ✗
{ country: 1, email: 1 }
Why it's wrong here
This index has country as the leading field, but the query does not filter on country. It only sorts on country. Since there is no equality predicate on country, the index cannot efficiently filter by email. The index would need to scan all entries for each country to find the email, which is inefficient.
- ✓
{ email: 1, country: 1 }
Why this is correct
This index supports the query by first filtering on email (equality) and then providing sorted results by country. The index prefix is email, and the sort field country follows. Since email is highly selective, the index will quickly locate the matching document(s) and the sort on country is satisfied by the index order for that email.
About these practice questions
One of 222 original C100DBA 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 C100DBA 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 C100DBA exam.