Reorder $project to be after limits and skips

XMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Duplicate
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Aggregation Framework
    • None
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • 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.

            Assignee:
            Unassigned
            Reporter:
            Craig Wilson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: