[DOCS-7852] Comment on: "manual/reference/operator/query/elemMatch.txt" Created: 12/May/16  Updated: 03/Nov/17  Resolved: 18/May/16

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

Type: Bug Priority: Major - P3
Reporter: je we Assignee: Unassigned
Resolution: Done Votes: 0
Labels: collector-298ba4e7
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu15.04, Mozilla firefox.

Location: https://docs.mongodb.com/v3.0/reference/operator/query/elemMatch/#op._S_elemMatch
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:44.0) Gecko/20100101 Firefox/44.0
Referrer: https://docs.mongodb.com/v3.0/reference/operator/update/pull/
Screen Resolution: 1920 x 1080


Participants:
Days since reply: 7 years, 39 weeks, 1 day ago

 Description   

Element Match: documentation issue (show wrong result)

Given the following documents in the scores collection:

{ _id: 1, results: [ 82, 85, 88 ] } { _id: 2, results: [ 75, 88, 89 ] }

db.scores.find(
{ results: { $elemMatch:

{ $gte: 80, $lt: 85 }

} }
)

The query returns the following document since the element 82 is both greater than or equal to 80 and is less than 85

Results:(Wrong results here)

{ "_id" : 1, "results" : [ 82, 85, 88 ] }

 Comments   
Comment by Kay Kim (Inactive) [ 18/May/16 ]

Hi –
thank you for filing this ticket, but I believe the results are correct and matches the explanation; namely that at least one element 82 in the results array is both greater than or equal to 82 and less than 85; i.e. 82 <= 82 < 85

{ "_id" : 1, "results" : [ 82, 85, 88 ] }

Regards,
Kay Kim

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