Indexing & Query Optimization

Query Plan

Any question that asks about:

  • Performance of a query
  • Relative performance of two or more queries
  • Why an index is used or not used

… should include explained query plans with execution statistics for all queries involved.

How to do it in: MongoDB shell.