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

    • Fully Compatible
    • ALL
    • v3.4
    • 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.
    • Query 2017-03-06

      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.

            Assignee:
            tess.avitabile@mongodb.com Tess Avitabile (Inactive)
            Reporter:
            daniel.moqvist@knowit.se daniel moqvist
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: