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

$ne perform a case sensitive find when it should do a case insensitive find based on collation settings

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 3.4.2
    • Fix Version/s: 3.4.3, 3.5.4
    • Component/s: Indexing, Querying
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v3.4
    • Steps To Reproduce:
      Hide

      use admin
      db.runReadCommand({ setFeatureCompatibilityVersion:"3.4"})
      use testdb
      db.createCollection("testcollection",{collation:{locale: "sv", strength:1, numericOrdering:true}})
      db.testcollection.insert( { data: "test" } )
      db.testcollection.insert( { data: "TEST" } )
       
      > db.testcollection.find({ data: { $eq: "test" } })
      { "_id" : ObjectId("58a461e0aa464d5347f68ecb"), "data" : "test" }
      { "_id" : ObjectId("58a461f0aa464d5347f68ecc"), "data" : "TEST" }
       
      > db.testcollection.find({ data: { $ne: "test" } })
      { "_id" : ObjectId("58a461f0aa464d5347f68ecc"), "data" : "TEST" }
      >//the above query should not result in any document but it returns the one with uppercase.
      

      Show
      use admin db.runReadCommand({ setFeatureCompatibilityVersion:"3.4"}) use testdb db.createCollection("testcollection",{collation:{locale: "sv", strength:1, numericOrdering:true}}) db.testcollection.insert( { data: "test" } ) db.testcollection.insert( { data: "TEST" } )   > db.testcollection.find({ data: { $eq: "test" } }) { "_id" : ObjectId("58a461e0aa464d5347f68ecb"), "data" : "test" } { "_id" : ObjectId("58a461f0aa464d5347f68ecc"), "data" : "TEST" }   > db.testcollection.find({ data: { $ne: "test" } }) { "_id" : ObjectId("58a461f0aa464d5347f68ecc"), "data" : "TEST" } >//the above query should not result in any document but it returns the one with uppercase.
    • Sprint:
      Query 2017-03-06

      Description

      Using the following collation settings on collection collation:

      {locale: "sv", strength:1, numericOrdering:true}

      makes $eq searches case insensitive.
      But when the filter is $ne it is not case insensitive.

        Attachments

          Activity

            People

            • Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: