[SERVER-26422] Group command does not group with respect to the collation Created: 30/Sep/16 Updated: 06/Dec/22 Resolved: 07/Apr/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | 3.3.15 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | David Storch | Assignee: | Backlog - Query Team (Inactive) |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Assigned Teams: |
Query
|
||||||||
| Operating System: | ALL | ||||||||
| Participants: | |||||||||
| Description |
|
If the group key is a string, the group command should put all documents whose strings compare equal under the collation into the same group. However, the groups are instead determined using a simple binary string comparison. This can be reproduced as follows:
I would expect this to return 2 groups under the English case-insensitive collation, but instead the server returns 4. |
| Comments |
| Comment by David Storch [ 07/Apr/17 ] |
|
Closing as Won't Fix due to the group command deprecation, as Asya suggested. |
| Comment by Asya Kamsky [ 28/Mar/17 ] |
|
Since group command has been deprecated, recommend closing this as won't fix. |
| Comment by David Storch [ 30/Sep/16 ] |
|
This is specific to the group command. Aggregation's $group is not affected. All we need to do to fix is make GroupStage::_groupMap use a BSONObjComparator with the proper collator. Right now we initialize _groupMap with the SimpleBSONObjComparator: https://github.com/mongodb/mongo/blob/r3.3.15/src/mongo/db/exec/group.cpp#L90 |