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

Allow group aggregations to limit collected records

    • Type: Icon: New Feature New Feature
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Aggregation Framework
    • None

      Consider this:

      {

        $group: {

          _id: "$SomeField",

          items:

      {       $push: "$_id"     }

        }

      }

      The aggregation above allows to return all ids grouped but what if you are only interested in the first 10 ids?

       

      It would be nice if $push would allow a limit so that only a certain number is returned.

       

      I often have to write queries to return oldest 10 records grouped by some criteria and it is almost impossible to do in mongodb at the moment.

            Assignee:
            carl.champain@mongodb.com Carl Champain (Inactive)
            Reporter:
            dev@easyauto123.com.au Developer Easyauto123
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: