Info
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.
Top User Comments
xgen-internal-githook commented on Mon, 30 Dec 2013 17:34:28 +0000:
Author:
{u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}
Message: SERVER-11952 fix $size match expression parsing for negative longs
Signed-off-by: Matt Kangas
Branch: master
https://github.com/mongodb/mongo/commit/44a01e7e4f4e86933ea792c1d110542d66560b6c
Steps to Reproduce
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" : [ ] }
>