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

$lt/$gt behaves differently when comparing null

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Works as Designed
    • Affects Version/s: 2.5.3
    • Fix Version/s: None
    • Component/s: Querying
    • Environment:
    • Backwards Compatibility:
      Major Change
    • Operating System:
      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

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: