Courseiva
Indexing →hardMultiple Choice

C100DEV Indexing Practice Question

An application queries a users collection with db.users.find({ email: "a@b.com" }). The collection holds about 2 million documents, and the email field is unique for every user. A developer proposes creating an index { email: 1, country: 1 } to speed up the query. What is the most accurate assessment of this proposal?

⚠ Common exam trap

The trap here is believing an index can only be used when the query includes every indexed field, or conversely that adding more fields always improves performance.

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

✓

It works, but it is wasteful; a single-field index { email: 1 } on this unique field would give the same lookup efficiency with a smaller index.

Because email is the leading field of the compound index, the planner can use it and seek directly to the single matching entry, so the query is still fast. But the trailing country key is never touched by this query, and email is already unique, so it adds no selectivity. A single-field index on email achieves the same lookup with less storage and lower write amplification.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✓

    It works, but it is wasteful; a single-field index { email: 1 } on this unique field would give the same lookup efficiency with a smaller index.

    Why this is correct

    The compound index can still serve the query because email is the leading field, so the planner can seek directly to the matching entry. However, since email is unique and the query filters only on email, the trailing country key is never used to narrow the scan. A single-field index { email: 1 } delivers identical lookup performance while consuming less space and adding less overhead to every write.

  • ✗

    It is invalid unless the index is declared as unique to match the field's uniqueness.

    Why it's wrong here

    MongoDB allows a non-unique compound index on a field whose values happen to be unique; uniqueness of the data is independent of the index option. Declaring unique is optional and, on a compound index, would enforce uniqueness across the email and country combination rather than on email alone, which is a different constraint than the scenario needs.

  • ✗

    It is optimal because compound indexes always outperform single-field indexes on the leading field.

    Why it's wrong here

    Compound indexes are not automatically faster than single-field indexes. Their advantage comes from covering multiple query predicates or sorts. Here the query touches only email, so the extra country key adds index size and write cost without improving selectivity, since email alone already matches at most one document per lookup.

  • ✗

    It fails because the query does not include the country field, so the compound index cannot be used.

    Why it's wrong here

    A compound index can serve a query that filters on a prefix of its key pattern. Because email is the leading field, the query engine can seek into the index using the email value alone and ignore the trailing country key. The index remains usable; the concern is efficiency, not whether the planner can select it.

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 →

How Courseiva writes practice questions · Editorial policy

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.