[SERVER-11952] empty arrays are matched with $size and NumberLong of -(2^63) Created: 04/Dec/13  Updated: 11/Jul/16  Resolved: 30/Dec/13

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: 2.5.4
Fix Version/s: 2.5.5

Type: Bug Priority: Major - P3
Reporter: Luke Lovett Assignee: David Storch
Resolution: Done Votes: 0
Labels: 26qa, nqf
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

> db.serverBuildInfo()
{
"version" : "2.5.5-pre-",
"gitVersion" : "ae5d69aff2bc5bed43e5a7536f295e655ab3bcf5",
"OpenSSLVersion" : "",
"sysInfo" : "Linux ip-10-2-29-40 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_49",
"loaderFlags" : "-fPIC -pthread -Wl,-z,now -rdynamic",
"compilerFlags" : "-Wnon-virtual-dtor -Woverloaded-virtual -fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -Werror -pipe -O3 -Wno-unused-function -Wno-deprecated-declarations -fno-builtin-memcmp",
"allocator" : "tcmalloc",
"versionArray" : [
2,
5,
5,
-100
],
"javascriptEngine" : "V8",
"bits" : 64,
"debug" : false,
"maxBsonObjectSize" : 16777216,
"ok" : 1
}
and
> db.serverBuildInfo()
{
"version" : "2.4.9-pre-",
"gitVersion" : "38b3b8f7395d6717efd570a62dc1c2c085d1b049",
"sysInfo" : "Linux ip-10-2-29-40 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_49",
"loaderFlags" : "-fPIC -pthread -rdynamic",
"compilerFlags" : "-Wnon-virtual-dtor -Woverloaded-virtual -fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -Werror -pipe -fno-builtin-memcmp -O3",
"allocator" : "tcmalloc",
"versionArray" : [
2,
4,
9,
-100
],
"javascriptEngine" : "V8",
"bits" : 64,
"debug" : false,
"maxBsonObjectSize" : 16777216,
"ok" : 1
}


Issue Links:
Related
Operating System: ALL
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" : [ ] }
>

Participants:

 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.



 Comments   
Comment by Githook User [ 30/Dec/13 ]

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 <matt.kangas@mongodb.com>
Branch: master
https://github.com/mongodb/mongo/commit/44a01e7e4f4e86933ea792c1d110542d66560b6c

Generated at Thu Feb 08 03:27:12 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.