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

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

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.5.5
    • Affects Version/s: 2.5.4
    • Component/s: Querying
    • Environment:
    • 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" : [ ] } >

      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.

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

              Created:
              Updated:
              Resolved: