[DOCS-5905] Comment on: "manual/reference/operator/query/elemMatch.txt" Created: 27/Jul/15  Updated: 03/Nov/17  Resolved: 27/Jul/15

Status: Closed
Project: Documentation
Component/s: None
Affects Version/s: None
Fix Version/s: 01112017-cleanup

Type: Bug Priority: Major - P3
Reporter: Docs Collector User (Inactive) Assignee: Kay Kim (Inactive)
Resolution: Done Votes: 0
Labels: collector-298ba4e7
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Location: http://docs.mongodb.org/manual/reference/operator/query/elemMatch/#op._S_elemMatch
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.89 Safari/537.36
Referrer: http://docs.mongodb.org/manual/reference/operator/query-array/
Screen Resolution: 2560 x 1440
repo: docs
source: reference/operator/query/elemMatch


Participants:
Days since reply: 8 years, 29 weeks, 2 days ago

 Description   

The results for
db.survey.find(
{ results: { $elemMatch: { product: "xyz", score:

{ $gte: 8 }

} } }
)

seems wrong.

Instead of :
{ "_id" : 3, "results" : [

{ "product" : "abc", "score" : 7 }

,

{ "product" : "xyz", "score" : 8 }

] }

, shouldn't it be:
{ "_id" : 3, "results" : [

{ "product" : "xyz", "score" : 8 }

] }

?



 Comments   
Comment by Kay Kim (Inactive) [ 27/Jul/15 ]

Emailed reporter regarding the diff between match condition and returning the whole document whose fields matched the condition.

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