Courseiva
Indexing →hardMultiple Choice

C100DEV Indexing Practice Question

A financial application has a collection `transactions` with fields `accountId`, `type`, `amount`, and `createdAt`. A query filters on `accountId` and `type`, sorts descending by `createdAt`, and projects only `_id` and `amount`. A developer creates the index `{ accountId: 1, type: 1, createdAt: -1 }`. Which statement best describes whether this index can support the query as a covered query?

⚠ Common exam trap

The trap here is believing that a query can be covered whenever the filter and sort match the index, forgetting that every projected field must also be present in 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

✓

It cannot be covered because the index lacks the `amount` field, so MongoDB must fetch documents to return `amount`.

A covered query requires that all fields used in the filter, sort, and projection exist in the index. Here the projected field `amount` is not part of the compound index, so MongoDB must fetch documents to return it. Neither excluding `_id` nor using `explain()` changes that; the index would need to include `amount`.

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 can be covered if the query uses `explain()` with the `covered` option, which forces MongoDB to answer from the index.

    Why it's wrong here

    There is no `covered` option for `explain()` that forces index-only execution. Coverage is determined by whether the index contains all required fields. If a projected field such as `amount` is absent from the index, MongoDB must fetch the document. `explain()` reports whether a query was covered, but it cannot make an uncovered query covered.

  • ✗

    It can be covered only if the projection explicitly excludes `_id`, because the index does not contain the `_id` field.

    Why it's wrong here

    The index `{ accountId: 1, type: 1, createdAt: -1 }` does not contain the `amount` field, which is projected in the query. A covered query requires that all fields returned to the client are present in the index. Since `amount` is missing from the index keys, the query cannot be covered regardless of whether `_id` is excluded.

  • ✓

    It cannot be covered because the index lacks the `amount` field, so MongoDB must fetch documents to return `amount`.

    Why this is correct

    For a query to be covered, every field in the query filter, sort, and projection must be included in the index. The projection includes `amount`, but the index does not contain `amount`. Therefore MongoDB must read the full documents to retrieve `amount`, and the query is not covered. Adding `amount` to the index would make coverage possible.

  • ✗

    It is automatically covered because `_id` is always included in every index, so all projected fields are present.

    Why it's wrong here

    MongoDB does not automatically add `_id` to every index. Only the `_id` field of the document is backed by the default `_id` index. A compound index like this one contains exactly the fields specified. Because `amount` is not in the index and `_id` is not automatically added, the projection cannot be satisfied from the index alone.

About these practice questions

This C100DEV question is part of Courseiva's 259-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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.