-
Type: New Feature
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Aggregation Framework
-
None
I was looking at the optimizing aggregation pipelines docs page and didn't see this one listed.
I don't know what the cost is to do a bunch of projections only to take the first 3 of them, but reordering the pipeline to push $project before limits and skips would remove the question.
So:
{ $project: { a: 1, b: 1} }, { $skip: 10 }
would look like this:
{ $skip: 10 }, { $project: {a :1, b: 1 } }
In addition, doing this might allow further skip/limit coalescence to further optimize the pipeline.
- duplicates
-
SERVER-12376 $skip and $limit should be moved before $project
- Closed