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

$lt/$gt behaves differently when comparing null

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Works as Designed
    • 2.5.3
    • None
    • Querying
    • Major Change
    • ALL

    Description

      Null is being treated differently by the $gt and $lt operators between versions.

      db.q.drop()
      db.q.insert({"a" : { "a" : 1 } })
      db.q.find( { "b" : { $lt : null } } ).itcount()
      db.q.find( { "b" : { $gt : null } } ).itcount()

      2.4.5: 1 doc per query
      2.5.4-Pre: zero doc per query

      Note
      The following queries behave the same on both versions and return zero documents

      db.q.find( { "b" : { $lte : null } } ).itcount()
      db.q.find( { "b" : { $gte : null } } ).itcount()

      Attachments

        1. server11414.js
          0.3 kB
          Benety Goh

        Issue Links

          Activity

            People

              benety.goh@mongodb.com Benety Goh
              alvin Alvin Richards (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: