Error
Error Code:
232
MongoDB Error 232: Max Sub-Pipeline Depth Exceeded
Description
This error indicates that an aggregation pipeline has exceeded the maximum allowed nesting depth for sub-pipelines. It typically occurs when using stages like `$lookup`, `$facet`, or `$graphLookup` with deeply nested aggregation expressions within them. MongoDB enforces this limit to prevent excessively complex or resource-intensive queries.
Error Message
Max Sub Pipeline Depth Exceeded
Known Causes
3 known causesDeeply Nested $lookup Stages
Your aggregation pipeline contains multiple `$lookup` stages that are nested within each other's sub-pipelines, exceeding the allowed depth.
Complex $facet Sub-Pipelines
The `$facet` stage is used with sub-pipelines that themselves contain further deeply nested aggregation expressions.
Recursive $graphLookup Structures
An overly complex or recursive `$graphLookup` definition can lead to excessive sub-pipeline depth during execution.
Solutions
Coming SoonGeneral Troubleshooting Tips
- Check the error message carefully for specific details
- Review recent changes that might have caused the error
- Search for the exact error code in the official documentation
- Check log files for additional context
- Try restarting the application or service