Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-26422

Group command does not group with respect to the collation

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 3.3.15
    • Component/s: Querying
    • None
    • Query
    • ALL

      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:

      db.c.drop();
      db.c.insert({_id: 1, str: "foo"});
      db.c.insert({_id: 2, str: "FOO"});
      db.c.insert({_id: 3, str: "bar"});
      db.c.insert({_id: 4, str: "BAR"});
      
      db.c.group({
          key: {str: 1},
          initial: {count: 0},
          reduce: function(curr, result) { result.count += 1; },
          collation: {locale: "en", strength: 2}
      });
      

      I would expect this to return 2 groups under the English case-insensitive collation, but instead the server returns 4.

            Assignee:
            backlog-server-query Backlog - Query Team (Inactive)
            Reporter:
            david.storch@mongodb.com David Storch
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: