Courseiva
Indexing →mediumMultiple Choice

C100DEV Indexing Practice Question

Your application executes the query: db.users.find({ age: { $gt: 30 } }, { age: 1, _id: 0 }). You have an index on { age: 1 }. How does MongoDB process this query?

⚠ Common exam trap

Candidates often forget that the '_id' field is included in documents by default; if the query does not explicitly exclude it, the index cannot cover the query.

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

✓

This is a covered query, and MongoDB retrieves all data from the index alone.

A covered query occurs when the index contains all the fields required by both the query filter and the projection. Because the query only requests the 'age' field and explicitly excludes '_id', MongoDB can fulfill the entire request by looking only at the index. This avoids the need to fetch documents from the heap, significantly improving performance.

Answer analysis

Option-by-option breakdown

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

  • ✗

    MongoDB performs an index scan followed by a fetch to get the 'age' values.

    Why it's wrong here

    Since the 'age' value is stored directly inside the index entries, there is no need for a 'FETCH' stage to go to the collection. The query engine recognizes that the index provides all the necessary data, allowing it to skip the document retrieval step entirely and return the values directly from the B-tree.

  • ✓

    This is a covered query, and MongoDB retrieves all data from the index alone.

    Why this is correct

    The query is considered 'covered' because the index on { age: 1 } contains the 'age' field used in the filter, and the projection only asks for 'age' while excluding '_id'. By satisfying the query without accessing the actual documents, MongoDB reduces disk I/O and speeds up the response time significantly.

  • ✗

    MongoDB must fetch the documents because projections are not supported in covered queries.

    Why it's wrong here

    Projections are actually essential for covered queries. Without a projection that limits the output to only fields present in the index (and excludes fields like '_id'), MongoDB would be forced to fetch the full document to satisfy the request. Projections and indexes work together to achieve the covered query optimization.

  • ✗

    The query cannot be covered because the _id field is always required from the document.

    Why it's wrong here

    While '_id' is included by default in query results, it can be explicitly excluded in the projection using { _id: 0 }. If the index does not include '_id' (which standard indexes don't), excluding it in the projection is a requirement for the query to be covered by the index on other fields.

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.