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:
- All fields in the query filter are part of the index.
- All fields returned in the projection are part of the index.
- The
_idfield 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?