[SERVER-7757] $all/$elemMatch does not expand arrays to look up fields Created: 25/Nov/12  Updated: 11/Jul/16  Resolved: 17/Feb/14

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: 2.6.0-rc0

Type: Bug Priority: Major - P3
Reporter: Aaron Staple Assignee: Benety Goh
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File server7756.js    
Issue Links:
Related
is related to SERVER-7385 Write named field extraction iterator... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

For a query like, { 'a.b':{ $all:[ { $elemMatch:

{ c:1 }

} ] } }, a field named 'a.b' will not be identified if 'a' is an array containing an object with field 'b':

c = db.c;
c.drop();
 
c.save( { a:{ b:[ { c:1 } ] } } );
printjson( c.find( { 'a.b':{ $all:[ { $elemMatch:{ c:1 } } ] } } ).toArray() );
 
c.remove();
c.save( { a:[ { b:[ { c:1 } ] } ] } );
// Does not match because the implementation does not handle the case where 'a' is an array.
printjson( c.find( { 'a.b':{ $all:[ { $elemMatch:{ c:1 } } ] } } ).toArray() );



 Comments   
Comment by Githook User [ 17/Feb/14 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-7757 added test cases for "a.b" $all + $elemMatch where a is document/array
Branch: master
https://github.com/mongodb/mongo/commit/306dfabf132eb7ef850171d5407dfaa3cbaddf82

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