Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-13063

Add the sort behaviour in the aggregation push accumlator

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Resolved
    • Priority: Major - P3
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: manual
    • Last comment by Customer:
      true
    • Story Points:
      2
    • Sprint:
      ServerDocs2020: Mar23 - Mar30, ServerDocs2020: Mar30 - Apr06, ServerDocs2020: Apr6 - Apr13, ServerDocs2020: Apr13 - Apr20, ServerDocs2020: Apr20 - Apr27

      Description

      Description

      Can we add a sort behavior for push operator just like we have for last and first accumulator ?

      https://docs.mongodb.com/manual/reference/operator/aggregation/last/#behavior

      https://docs.mongodb.com/manual/reference/operator/aggregation/first/#behavior

      Something like

      Behavior

      When using $push in a $group stage, the $group stage should follow a $sort stage to have the input documents in a defined order.
       

      NOTE

      Although the $sort stage passes ordered documents as input to the $group stage, $group is not guaranteed to maintain this sort order in its own output.
       
       

       

      Scope of changes

      Impact to Other Docs

      MVP (Work and Date)

      Resources (Scope or Design Docs, Invision, etc.)

        Attachments

          Activity

            People

            Assignee:
            naomi.pentrel Naomi Pentrel
            Reporter:
            Sagar Sagar
            Participants:
            Last commenter:
            Naomi Pentrel Naomi Pentrel
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since reply:
              7 weeks, 4 days ago
              Date of 1st Reply: