Aggregation pipeline stages have a limit of 100 MB. To handle large datasets, allowDiskUse
enables writing to temporary files.
But have this optional any defect? If haven't, why the default is false?
The performance impact described in the answer from @prasad_ still holds true (hard-drive or storage will be slower than memory).
However, starting in MongoDB 6.0 the behavior of allowDiskUse
has changed as it now defaults to true. That is, unless one explicitly disallows disk use with allowDiskUse(false)
MongoDB resorts to disk use for (non-index) sorts requiring more than 100 MB memory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With