[SERVER-11984] Can't perform queries on sub-documents stored in a field name = the value of that document's index within an array in version 2.4 Created: 05/Dec/13  Updated: 11/Jul/16  Resolved: 09/Dec/13

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

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

{
"version" : "2.4.9-pre-",
"gitVersion" : "5779b6e198c0dd22a99e12837faea4b5e8b2664f",
"sysInfo" : "Darwin bs-osx-106-x86-64-2.10gen.cc 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49",
"loaderFlags" : "-fPIC -pthread -rdynamic -m64",
"compilerFlags" : "-Wnon-virtual-dtor -Woverloaded-virtual -fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -O3 -m64",
"allocator" : "system",
"versionArray" : [
2,
4,
9,
-100
],
"javascriptEngine" : "V8",
"bits" : 64,
"debug" : false,
"maxBsonObjectSize" : 16777216,
"ok" : 1
}


Issue Links:
Related
Backwards Compatibility: Minor Change
Operating System: ALL
Steps To Reproduce:

2.4.9-pre-

> db.c.insert({a:[{"0":{b:"Hello"}}]})
> db.c.find({"a.0.b":"Hello"})
>

Compare that to 2.5.5-pre-:

> db.c.insert({a:[{"0":{b:"Hello"}}]})
Insert WriteResult({ "ok" : 1, "n" : 1 })
> db.c.find({"a.0.b":"Hello"})
{ "_id" : ObjectId("52a10cd0dd47ad0373e22ae6"), "a" : [ { "0" : { "b" : "Hello" } } ] }
>

Participants:

 Description   

Versions 2.4 and 2.5 of MongoDB return different results when performing a query on a sub-document stored in a field that has a numeric name that happens to be the value of the index at which that document is stored within an array field.



 Comments   
Comment by Daniel Pasette (Inactive) [ 09/Dec/13 ]

benety.goh, can you add a unit test which documents this behavior.

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