[SERVER-11406] Change in behavior on how $gte work with an array as a parameter Created: 28/Oct/13  Updated: 10/Dec/14  Resolved: 15/Nov/13

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: 2.5.3
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Alvin Richards (Inactive) Assignee: hari.khalsa@10gen.com
Resolution: Duplicate Votes: 0
Labels: 26qa, nqf, query_triage
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

> db.serverBuildInfo()
{
"version" : "2.5.4-pre-",
"gitVersion" : "d8ca8b5faa1447365403cfb8da16a041e7d31d95",
"OpenSSLVersion" : "",
"sysInfo" : "Darwin vero 12.5.0 Darwin Kernel Version 12.5.0: Sun Sep 29 13:33:47 PDT 2013; root:xnu-2050.48.12~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49",
"loaderFlags" : "-fPIC -pthread -Wl,-bind_at_load -mmacosx-version-min=10.6",
"compilerFlags" : "-Wnon-virtual-dtor -Woverloaded-virtual -fPIC -fno-strict-aliasing -ggdb -pthread -Wno-unknown-pragmas -Winvalid-pch -pipe -O3 -Wno-unused-function -Wno-deprecated-declarations -mmacosx-version-min=10.6",
"allocator" : "tcmalloc",
"versionArray" : [
2,
5,
4,
-100
],
"javascriptEngine" : "V8",
"bits" : 64,
"debug" : false,
"maxBsonObjectSize" : 16777216,
"ok" : 1
}


Issue Links:
Duplicate
is duplicated by SERVER-11444 $lt/$lte/$gte/$gt behaves differently... Closed
Related
is related to SERVER-11377 $gte doesn't match whole arrays but e... Closed
Backwards Compatibility: Major Change
Operating System: ALL
Participants:

 Description   

The construct

{ $gte : [ ... ] }

is processed differently between 2.4.5 and 2.5.4-Pre.

Reproduce:

db.q.drop()
db.q.insert({"b" : [  1,  [  [  {   } ] ],  {  "1" : [  false ] } ] })
db.q.insert({"b" : [  [  ISODate("2013-09-29T00:00:00Z") ] ] })
db.q.insert({"b" : [ 	{ 	"0" : 0, 	"d" : { 	"a" : Infinity } }, 	[ 	{ 	"d" : { 	"a" : { 	 } } } ] ] })
db.q.insert({"b" : [ 	[ 	ISODate("2008-02-29T00:00:00Z") ], 	"An inventor is simply a fellow who doesnt take his education too seriously." ] })
db.q.find( { "b" : { $gte : [ 314159265015 , { } , { "a" : 314159265004 } ] } } ).itcount()
db.q.find( { "b" : { $gte : [ 314159265015 , { } ] } } ).itcount()
db.q.find( { "b" : { $gte : [ 314159265015 , { "a" : 314159265004 } ] } } ).itcount()
db.q.find( { "b" : { $gte : [ { } ] } } ).itcount()

2.4.5: 4 documents returned for each query
2.5.4-Pre: Zero documents returned for each query

Note:
The query below returns the same (zero) documents on both versions

db.q.find( { "b" : { $gte : 314159265015 } } ).itcount()



 Comments   
Comment by Alvin Richards (Inactive) [ 28/Oct/13 ]

Another example of this

db.q.drop()
db.q.insert({"b" : [  314159265010,  314159265001,  [  314159265000,  "" ] ] })
db.q.insert({"b" : [  1,  [  [  {   } ] ],  {  "1" : [  false ] } ] })
db.q.insert({"b" : [  [  ISODate("2013-09-29T00:00:00Z") ] ] })
db.q.insert({"b" : [ 	{ 	"0" : 0, 	"d" : { 	"a" : Infinity } }, 	[ 	{ 	"d" : { 	"a" : { 	 } } } ] ] })
db.q.insert({"b" : [ 	[ 	ISODate("2008-02-29T00:00:00Z") ], 	"An inventor is simply a fellow who doesnt take his education too seriously." ] })
db.q.find( { "b" : { $gte : [ 0 , 1 , { "a" : { "d" : false } } , ISODate("0000-01-01") ] } } ).itcount()

2.4.5: 5 docs returned
2.5.4-Pre: zero docs returned

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