add aggregation stage $countBy which is equivalent to group with sum

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Aggregation Framework
    • Query Optimization
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      It would be nice to have syntactic sugar for the following stage which I type all the time:

      {$group:{_id:"$field", count:{$sum:1}}}
      

      Something like {$countBy:"$field"} would be more readable and be analogous to $count and $sortByCount stages (and would use same field names as sortByCount - i.e. count field for sum)

            Assignee:
            [DO NOT USE] Backlog - Query Optimization
            Reporter:
            Asya Kamsky
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: