-
Type: Task
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: manual
-
Labels:
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.