MongoDB · Query & indexes · L1
← Query performance across the stack
A find() with a filter and a sort does a full collection scan because no compound index supports it.
A list endpoint times out as the collection grows. explain() reports a COLLSCAN with a high totalDocsExamined, far above the number of documents returned.
The query filters on an equality field and sorts on another, but there's no compound index covering both, so MongoDB scans every document and sorts in memory (risking the 32MB sort limit).
Seed a collection of several million documents and a query that filters by status and sorts by createdAt, with the supporting compound index dropped.
Prototype — scenario content is a preview; the live sandbox is not wired up.