-
Type: Bug
-
Resolution: Works as Designed
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
ALL
-
We would like to use std::sort (unstable sorting) instead of std::stable_sort in sorter.cpp because of the performance gains. While experimenting with this change, I found that $group with $first relies on stable sorting. With unstable sorting, the behavior does not match the documentation at https://www.mongodb.com/docs/manual/reference/operator/aggregation/first/#behaviors, specifically
> To define the document order for $first in other pipeline stages, add a preceding $sort stage.
The sorter change is in https://github.com/10gen/mongo/pull/17859.
cc david.percy@mongodb.com This may be related to SERVER-85337.
- is depended on by
-
SERVER-81571 Reconsider stable sort in sorter.cpp
- Closed
- is related to
-
SERVER-85337 $bucketAuto $first does not obey input order
- Closed