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

empty arrays are matched with $size and NumberLong of -(2^63)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.5.4
    • Fix Version/s: 2.5.5
    • Component/s: Querying
    • Labels:
    • Environment:
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      2.4.9-pre-

      > db.a.insert({arr:[]})
      > db.a.find({arr:{$size:NumberLong("-9223372036854775808")}})
      >

      2.5.5-pre-

      > db.a.insert({arr:[]})
      Insert WriteResult({ "ok" : 1, "n" : 1 })
      > db.a.find({arr:{$size:NumberLong("-9223372036854775808")}})
      { "_id" : ObjectId("529f77fca01bf21d39c74b48"), "arr" : [ ] }
      >

      Show
      2.4.9-pre- > db.a.insert({arr:[]}) > db.a.find({arr:{$size:NumberLong("-9223372036854775808")}}) > 2.5.5-pre- > db.a.insert({arr:[]}) Insert WriteResult({ "ok" : 1, "n" : 1 }) > db.a.find({arr:{$size:NumberLong("-9223372036854775808")}}) { "_id" : ObjectId("529f77fca01bf21d39c74b48"), "arr" : [ ] } >

      Description

      Documents with empty arrays can be matched using the $size operator on the array field using the number -(2 ^ 63) as an argument. This problem affects 2.5.x of MongoDB but not 2.4.x.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: