intermediateMongoDB Performance Optimization — Explain Plan, Covered Queries & Pagination
What's the clearest signal in explain() output that a query is missing a useful index?
A large gap between totalDocsExamined and nReturned — it means MongoDB scanned far more documents than it actually needed to return, which is the direct symptom of a missing or unhelpful index for that query's filter shape.
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response