[DOCS-10250] Comment on: "manual/reference/operator/projection/positional.txt" Created: 12/May/17 Updated: 29/Oct/23 Resolved: 02/Nov/17 |
|
| Status: | Closed |
| Project: | Documentation |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Docs Collector User (Inactive) | Assignee: | Irene Smith |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | collector-298ba4e7 | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Location: https://docs.mongodb.com/manual/reference/operator/projection/positional/#proj._S_ |
||
| Participants: | |
| Days since reply: | 6 years, 15 weeks, 1 day ago |
| Description |
|
"Both the $ operator and the $elemMatch operator project a subset of elements from an array based on a condition." This sentence reads like the $ operator will project multiple elements into the result, if more than one element of the array is matched by the query document. While one element is a subset it gives the impression that the operators could project multiple elements. The quoted sentence seems ambiguous and feels to me like it contradicts the first paragraph where it very clearly states the $ and $elemMatch only project the first element. The page about the $elemMatch projection operator has the same formulation. "The following query will return any embedded documents inside a grades array that have a mean of greater than 70 and a grade of greater than 90." I think this sentence is just factually wrong. The query below will only return the first document inside the grades array which matches the query. Unless I misunderstood how those operators work, clarifying some of the documentation would help others who are looking for a way to filter an array in the projected result. From what I understand the correct way is to use aggregation if you want a result which filters an array. |
| Comments |
| Comment by Githook User [ 31/Oct/17 ] |
|
Author: {'email': 'irenesmith@Irenes-MacBook-Pro.local', 'name': 'Irene Smith'}Message: Signed-off-by: kay <kay.kim@10gen.com> |
| Comment by Githook User [ 31/Oct/17 ] |
|
Author: {'email': 'irenesmith@Irenes-MacBook-Pro.local', 'name': 'Irene Smith'}Message: Signed-off-by: kay <kay.kim@10gen.com> |
| Comment by Githook User [ 31/Oct/17 ] |
|
Author: {'email': 'irenesmith@Irenes-MacBook-Pro.local', 'name': 'Irene Smith'}Message: Signed-off-by: kay <kay.kim@10gen.com> |
| Comment by Irene Smith [ 31/Oct/17 ] |
|
Pushed and pull request created: |
| Comment by Irene Smith [ 03/Oct/17 ] |
|
Changed both instances mentioned in the task to clearly indicate that only the first match is returned from each document. |