Q27: What is the RAM limit for an aggregation stage, and how do you bypass it?
Pipeline stages have a default memory limit of 100 Megabytes of RAM. If a stage (like $sort or $group) exceeds 100MB, MongoDB throws an error. To bypass this, pass { allowDiskUse: true }, allowing pipeline stages to spill temporary data to disk files.
Key Takeaways
- Default aggregation stage RAM ceiling: 100MB.
- Use
{ allowDiskUse: true }to write intermediate data to temporary disk space.
Knowledge Check
Which query option allows aggregation stages to exceed the 100MB RAM processing limit?