-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.2.0-rc0
-
Component/s: Querying
-
None
-
ALL
When matching multiple items in inner collections / document arrays, selecting with
{ 'innerCollection.$' : 1 }only returns one of the matched element.
e.g.:
Doing
> db.testCollection.insert({ name : 'Albert', innerCollection : [
{memberId: 'red'},
{memberId : 'green'} ] })
> db.testCollection.insert({ name : 'Beatrice', innerCollection : [
,
{memberId : 'blue'} ] })
> db.testCollection.insert({ name : 'Carl', innerCollection : [
,
{memberId : 'blue'}] })
> db.testCollection.find({ $and : [
{'innerCollection.memberId' : 'blue'},
{'innerCollection.memberId' : 'red'}]},
{'innerCollection.$' : 1})
{ "_id" : ObjectId("5011c44a5748f01ae71d50d7"), "innerCollection" : [
] }
properly finds the requested documents, but the innerCollection item only returns the element matching
{ 'innerCollection.memberId' : 'red' }.
- duplicates
-
SERVER-1013 positional $ operator field mismatch
- Closed