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

$gte is behaving differently comparing nulls

    XMLWordPrintable

Details

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

    Description

      $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

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: