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

$gte is behaving differently comparing nulls

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.5.3
    • Component/s: Querying
    • Environment:
    • Major Change
    • ALL

      $gte comparing null with number differs

      For the most part $gte is behaving differently between versions
      2.4.5 0 $gte null : False
      2.5.4 0 $gte null : True

      It does seem to be affected by schema, see second case below.

      Reproduce:

      db.q.drop()
      db.q.insert({"b" : [ { "d" : 314159265019 }, { "b" : 0 }, { "0" : 314159265019 } ] })
      db.q.find( { "b.b" : { $gte : null } } ).itcount()
      

      2.4.5: Zero documents returned
      2.5.4-Pre: 1 Document returned

      As the structure changes, the behavior changes

      db.q.drop()
      db.q.insert({"b" : [ { "b" : 0 } ] })
      db.q.find( { "b.b" : { $gte : null } } ).itcount()
      

      2.4.5: Zero documents returned
      2.5.4-Pre: Zero Document returned

        1. server11422.js
          0.6 kB
          Benety Goh

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

              Created:
              Updated:
              Resolved: