Q34: What is a Covered Query in MongoDB?

A Covered Query is a query that can be satisfied entirely from an index without inspecting any underlying documents from disk or memory. Criteria:

  1. All fields in the query filter are part of the index.
  2. All fields returned in the projection are part of the index.
  3. The _id field is explicitly excluded ({ _id: 0 }) unless indexed.
Key Takeaways
  • Zero document fetches (totalDocsExamined = 0).
  • Extremely fast; reads strictly from RAM index B-Trees.
Knowledge Check

What is totalDocsExamined for a fully Covered Query in an explain plan execution result?