[SERVER-3362] allow query option to return found documents enclosed in a "meta" document containing array offset information Created: 03/Jul/11 Updated: 06/Dec/22 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | tony kerz | Assignee: | Backlog - Query Execution |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Query Execution
|
| Participants: |
| Description |
|
if i have a collection of documents like: { name: 'fred', children: [ { name: 'bill', age: 10 }, { name: 'bob', age: 20 }, { name: 'ed', age: 30 }] } and i want to operate on all children whose age is greater than 10, i don't believe there is a direct way to accomplish this. i'm coming at this from the context of this jira entry: https://jira.mongodb.org/browse/SERVER-3347 i believe in the multi-geo case the document is returned once for each hit, which implies that multiple elements of an array met the search criteria. in the multi-non-geo case the document is returned only once, i think it would be best to remain consistent, and in SERVER-3347 i suggest returning the document only once (after all returning the same document multiple times doesn't add much value), i think the same pattern may be applicable to the multi-non-geo case, in a way to address the case in between the $ position operator and the multi (apply to all) mechanism. so if there was a way to return something like: { , {field: "children.age", index: 2 } ], i think it would give the caller enough information to operate on those elements of the array that were of interest...? |