[DOCS-13063] Add the sort behaviour in the aggregation push accumlator Created: 30/Sep/19  Updated: 30/Oct/23  Resolved: 20/Apr/21

Status: Closed
Project: Documentation
Component/s: manual
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Task Priority: Major - P3
Reporter: Sagar Assignee: Naomi Pentrel (Inactive)
Resolution: Done Votes: 0
Labels: docs-onboarding-candidate
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Participants:
Days since reply: 2 years, 42 weeks, 1 day ago
Epic Link: DOCSP-1769
Story Points: 2

 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.)



 Comments   
Comment by Githook User [ 20/Apr/21 ]

Author:

{'name': 'Naomi Pentrel', 'email': '5212232+npentrel@users.noreply.github.com', 'username': 'npentrel'}

Message: DOCS-13063 Clarify $group order behaviour
Branch: v3.6
https://github.com/mongodb/docs/commit/f17390c67796ef7fb9085023d9e16f20888d5598

Comment by Githook User [ 20/Apr/21 ]

Author:

{'name': 'Naomi Pentrel', 'email': '5212232+npentrel@users.noreply.github.com', 'username': 'npentrel'}

Message: DOCS-13063 Clarify $group order behaviour
Branch: v4.0
https://github.com/mongodb/docs/commit/e0025f2d7840060efd609b9a592a7e832b4b4755

Comment by Githook User [ 20/Apr/21 ]

Author:

{'name': 'Naomi Pentrel', 'email': '5212232+npentrel@users.noreply.github.com', 'username': 'npentrel'}

Message: DOCS-13063 Clarify $group order behaviour
Branch: v4.2
https://github.com/mongodb/docs/commit/a77fa50160ffc0dca32d338ef7f17a2a819cf32d

Comment by Githook User [ 20/Apr/21 ]

Author:

{'name': 'Naomi Pentrel', 'email': '5212232+npentrel@users.noreply.github.com', 'username': 'npentrel'}

Message: DOCS-13063 Clarify $group order behaviour
Branch: master
https://github.com/mongodb/docs/commit/a62c15e31f802ab2c5cd8e2bda19d0e01a2701ec

Comment by Githook User [ 19/Apr/21 ]

Author:

{'name': 'Naomi Pentrel', 'email': '5212232+npentrel@users.noreply.github.com', 'username': 'npentrel'}

Message: DOCS-13063 Clarify $group order behaviour
Branch: v5.0
https://github.com/mongodb/docs/commit/1abbc1c9009fb128c5bb719efaf61690b5e295a0

Comment by Naomi Pentrel (Inactive) [ 23/Mar/21 ]

CR: https://mongodbcr.appspot.com/777900010/

Generated at Thu Feb 08 08:06:51 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.