[SERVER-299] Field Matcher: shared stem returns invalid results Created: 17/Sep/09  Updated: 12/Jul/16  Resolved: 28/Oct/09

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: 1.0.0, 1.1.0
Fix Version/s: 1.1.3

Type: Bug Priority: Major - P3
Reporter: Mina Naguib Assignee: Mathias Stearn
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

linux x86_64, tested on both versions 1.0.0 and 1.1.0


Participants:

 Description   

The following works as expected (notice the shared stem "foo" is 1 level deep):
> db["partial_test"].save({foo: {bar: 20}})
> db["partial_test"].save({foo: {baz: 30}})
> db["partial_test"].find({},

{"foo.bar": 1, "foo.baz": 1}

)
{"_id" : ObjectId( "4ab26302c030ee7ea3cec844") , "foo" : {"bar" : 20}}
{"_id" : ObjectId( "4ab26308c030ee7ea3cec845") , "foo" : {"baz" : 30}}

However. if the shared stem is 2 levels deep ("foo.bar") the returned results are wonky:
> db["partial_test"].save({foo: {bar:

{baz1: 20}

}})
> db["partial_test"].save({foo: {bar:

{baz2: 20}

}})
> db["partial_test"].find({},

{"foo.bar.baz1": 1, "foo.bar.baz2": 1}

)
{"_id" : ObjectId( "4ab2733fc030ee7ea3cec847") , "foo" : {"bar" :

{"baz1" : 20}

, "bar" :

{"baz1" : 20}

}}
{"_id" : ObjectId( "4ab27341c030ee7ea3cec848") , "foo" : {"bar" : {} , "bar" : {}}}


Generated at Thu Feb 08 02:53:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.