DBAtlas · Database operations atlas

292: QueryExceededMemoryLimitNoDiskUseAllowed (error code 292)

MongoDB

What does it mean?

A query or aggregation stage exceeded the allowed memory limit (default 100 MB) and failed because writing to disk was not allowed. Usually seen in sort or group stages.

Why does it happen?

In-memory sorting over large unindexed data, large $group/$sort aggregation stages, very large intermediate result sets, the allowDiskUse:false setting.

How to fix it

Allow spilling to disk in the aggregation with the allowDiskUse:true option: db.collection.aggregate(pipeline, {allowDiskUse:true}). Reduce memory usage by indexing the sorted fields. Filter the pipeline early with $match to reduce the data processed. Paginate results if necessary. In MongoDB 6.0+, disk use is enabled by default in most cases.

Open in DBAtlas →

More from this engine