Covered index with collated field returns incorrect result when collation not involved in match or sort

XMLWordPrintableJSON

    • Fully Compatible
    • ALL
    • v4.0, v3.6, v3.4, v3.2
    • Query 2018-06-18, Query 2018-07-02, Query 2018-07-16, Query 2018-07-30, Query 2018-08-13
    • None
    • 0
    • None
    • None
    • None
    • None
    • None
    • None

      It appears that when covered index can be used, but collation isn't involved in match or sort then the strings from covered index query are returned without being looked up.

      db.stringtest.insertOne({ int: 1, text: "hello world" });
      db.stringtest.createIndex({ int: -1, text: -1 }, { collation: { locale: "en", strength: 1 }});
      db.stringtest.find({ int: 1 }, { _id: 0, int: 1, text: 1 })
      // expected result { int: 1, text: "hello world" }
      // actual result
      {"int" : 1, "text" : "71??E\u0004UEK?/" } 

            Assignee:
            Ian Boros
            Reporter:
            Asya Kamsky
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: