Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-1670

explain().find() ignores collation

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 2.2.11
    • Affects Version/s: None
    • Component/s: None
    • Environment:
      OS: macOS 14.2
      node.js / npm versions:
      Additional info:
    • 2
    • Not Needed
    • Iteration Fortitudo

      Problem Statement/Rationale

      db.createCollection("special", { collation: { locale: "de", strength: 1 } })
      db.special.insert({ _id: "yes" })
      
      // This returns empty, as it should:
      db.special.find({_id:"yës"}, null, {collation: { locale: "simple" } })
      

      … then do an explain on that:

      db.special.explain().find({_id:"yës"}, null, {collation: { locale: "simple" } })
      {
        queryPlanner: {
          plannerVersion: 1,
          namespace: 'test.special',
          indexFilterSet: false,
          parsedQuery: { _id: { '$eq': 'yës' } },
          collation: {
            locale: 'de',
            caseLevel: false,
            caseFirst: 'off',
            strength: 1,
            numericOrdering: false,
            alternate: 'non-ignorable',
            maxVariable: 'punct',
            normalization: false,
            backwards: false,
            version: '57.1'
          },
      ...
      

      Note the “locale: 'de'” in the above. It should instead honor the collation given in the request.

      This seems likely related to NODE-5510, where the node.js driver quietly drops parts of the request.

      Steps to Reproduce

      See above.

      Expected Results

      The explain() should reflect simple collation.

      Actual Results

      The explain() shows the same result as if I didn’t specify collation at all.

            Assignee:
            alena.khineika@mongodb.com Alena Khineika
            Reporter:
            felipe.gasper@mongodb.com Felipe Gasper
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: