-
Type: Bug
-
Resolution: Fixed
-
Priority: Critical - P2
-
Affects Version/s: 3.6.1
-
Component/s: Aggregation Framework
-
None
-
Fully Compatible
-
ALL
-
v3.6, v3.4
-
-
Query 2018-01-01
Let's say we are performing an in-memory sort with the $sort aggregation stage, and the sort involves a non-simple collation. This is what happens in DocumentSourceSort:
- We create a Sorter that uses a Comparator taken from the ExpressionContext. This comparator is collation-aware.
- While doing work, we encounter a document with an array. We use the SortKeyGenerator to generate the sort key. Because the collator is non-simple, the value is mapped to its ICU comparison key.
- When we are done loading documents into the Sorter, we perform a stable sort. Because we are sorting ICU comparison keys, we should be using binary comparisons, but instead we are using the collation-aware comparator from the ExpressionContext. The sorted output we get is then meaningless.
- is depended on by
-
SERVER-32956 Unblacklist aggregation/sources/sort/collation_sort.js from the aggregation sharded collections passthrough
- Closed
- is duplicated by
-
SERVER-32297 Aggregations that merge on mongos do not respect the collation
- Closed