Quick Answer
Aggregation pipelines that produce large intermediate results use memory. MongoDB limits aggregation memory to 100MB by default. If exceeded, the pipeline fails unless you add allowDiskUse: true (allows spilling to disk - slower). Optimize: add $match and $project early to reduce document size before expensive stages, use indexes in $match, avoid $unwind on large arrays early in the pipeline.
Answer
Large pipelines may spill to disk when memory is insufficient, drastically slowing performance.
S
SugharaIQ Editorial Team
Verified Answer
This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.
MongoDB interview questions and answers for beginner, junior, mid-level, senior, and expert developers. Perfect for freshers and experienced candidates.