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

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

    XMLWordPrintable

Details

    • 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

    Description

      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?/" } 

      Attachments

        Activity

          People

            ian.boros@mongodb.com Ian Boros
            asya.kamsky@mongodb.com Asya Kamsky
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: