Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-31082

when $count is at the end of multiple stages that don't change the number of documents in pipeline, those stages can be eliminated

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Aggregation Framework
    • None
    • Query Optimization

    Description

      Something that looks like this:

      {$match:{}},
      {$project:{}},
      {$lookup:{}},
      {$addFields:{}},
      {$lookup:{}},
      {$count:"c"}
      

      is basically a $match followed by a $count. It would be nice if aggregation had a way of figuring that out.

      Attachments

        Activity

          People

            backlog-query-optimization Backlog - Query Optimization
            asya.kamsky@mongodb.com Asya Kamsky
            Votes:
            1 Vote for this issue
            Watchers:
            12 Start watching this issue

            Dates

              Created:
              Updated: