[SERVER-1144] Provide way to give counts of array attributes in projection Created: 24/May/10 Updated: 06/Dec/22 Resolved: 19/May/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | 1.5.1 |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Minor - P4 |
| Reporter: | Doug Hudson | Assignee: | Backlog - Query Team (Inactive) |
| Resolution: | Done | Votes: | 8 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Query
|
| Participants: |
| Description |
|
Obtaining counts for large attributes can be a pain. Approaches are to: I think being able to request embedded array length directly would be helpful. Perhaps something like: |
| Comments |
| Comment by David Storch [ 19/May/17 ] |
|
Closing as Gone Away per Asya's comment above. The documentation for the $size expression, which was added in version 2.6, is available here: https://docs.mongodb.com/manual/reference/operator/aggregation/size/ |
| Comment by Asya Kamsky [ 16/May/17 ] |
|
This can be done via aggregation $project stage using $size expression. |