-
Type: Improvement
-
Resolution: Duplicate
-
Priority: Minor - P4
-
None
-
Affects Version/s: 4.4.6
-
Component/s: None
-
None
We have some slow large aggregation pipelines where a $limit at the end is not sufficient to prevent slow queries, and where a $limit early in the pipeline would give incorrect results.
Hence we want to have a way to limit early but abort the query instantly if this limit is hit:
For example:
aggregate([
{ $match: {....}},
{ $imaginaryNewAbortOnCondition: {
count: {$gt: 100},
message: "Too many rockets found, please limit the search range"
}
},
{ $lookupUnwindOrOtherExpensiveAggregations: {...}},
{ $limit: 100 }
])
I think limit is our main use case but one could also imagine other uses where a more dynamic condition is useful.
- duplicates
-
SERVER-40117 "$exit" aggregation stage (with $cond operator support)
- Backlog