Details
-
Improvement
-
Resolution: Unresolved
-
Trivial - P5
-
None
-
None
-
None
-
Query Optimization
Description
It would be nice if we could exit out of an Aggregate Pipeline. For example:
db.books.aggregate([
|
{$match:{ _id: ObjectId('5bede977e8dd7e5d5df79dab') }},
|
{$limit: 20},
|
{$exit: { $cond: [ { $in: ['$genre',['science fiction', 'fantasy']}, true, false ] }},
|
{$sort: { created: -1 }} // sort is skipped
|
]);
|
It would also be nice for debugging longer pipelines:
db.tapping.aggregate([
|
{$match:{ _id: ObjectId('5bede977e8dd7e5d5df79dab') }},
|
{$exit: true }, // rest of pipeline would be skipped
|
...
|
]);
|
Thanks for your consideration.
Attachments
Issue Links
- is duplicated by
-
SERVER-56832 Provide aggregation stage to abort pipeline halfway through
-
- Closed
-
- related to
-
SERVER-51889 Introduce new stage to peek / debug a pipeline stage's output
-
- Closed
-