[SERVER-3463] Query by multiple attributes on an Embedded Object Created: 22/Jul/11  Updated: 07/Apr/23  Resolved: 22/Jul/11

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

Type: Improvement Priority: Major - P3
Reporter: Dave Krupinski Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

Currently the querying options on embedded objects is limited to either a single attribute in an embedded object, or else finding against the entire contents of the embedded object.

It would be extremely useful to be able to do a narrow query that will only match if all the parameters match a single (or more) row in the embedded object.

Syntactically I could see dot notation down to the field that contains the embedded objects, and then reused of $and operator:

db.collection.find({ embeds : { $and : [

{ first_name : "Leslie" }

,

{ last_name : "Nielsen" }

] } })



 Comments   
Comment by Scott Hernandez (Inactive) [ 22/Jul/11 ]

This is what $elemMatch does: http://www.mongodb.org/display/DOCS/Advanced%20Queries#AdvancedQueries-%24elemMatch

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