292 — QueryExceededMemoryLimitNoDiskUseAllowed

queryperformance

Aggregation exceeded the memory limit and allowDiskUse is not enabled

What is happening?

QueryExceededMemoryLimitNoDiskUseAllowed is returned when an aggregation pipeline stage (such as $sort, $group, $bucket, or $facet) exceeds the per-stage memory limit (default 100 MB) and the pipeline was not run with allowDiskUse: true. Without disk spillover, the server aborts the pipeline to prevent excessive memory consumption.

Common causes

  1. $sort on a large result set without an index that supports the sort order
  2. $group accumulating too many distinct groups in memory
  3. $facet running multiple sub-pipelines that individually exceed the limit
  4. $lookup producing a large joined result set
  5. The 100 MB default limit is too small for the dataset

Source code references

ErrorCodes::QueryExceededMemoryLimitNoDiskUseAllowed found in 26 locations in the MongoDB server source.

Diagnostic Steps

Related Issues