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

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

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 2.5.5
    • 2.5.4
    • Querying
    • ALL
    • 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

            david.storch@mongodb.com David Storch
            luke.lovett Luke Lovett
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: