[SERVER-4376] Determining array and document size (number of keys) without loading document to client Created: 27/Nov/11 Updated: 06/Dec/22 Resolved: 26/Dec/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | 2.0.1 |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Minor - P4 |
| Reporter: | Aristarkh Zagorodnikov | Assignee: | Backlog - Query Team (Inactive) |
| Resolution: | Done | Votes: | 7 |
| Labels: | array, query, size | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Query
|
| Backwards Compatibility: | Fully Compatible |
| Participants: |
| Description |
|
In our environment, the ability to determine array and document sizes without transferring them over the wire would be very welcome. I guess that existing syntax for queries ($size) would do nicely. |
| Comments |
| Comment by Asya Kamsky [ 26/Dec/17 ] |
|
Size of arrays and other schema/document properties can be handled on the server (without bringing document back to client). |
| Comment by Asya Kamsky [ 02/Feb/17 ] |
|
As of 3.4, aggregation supports fetching sizes of arrays, sizes strings and types of fields. Future enhancements will include ability to extract all key names. This should enable pushing array and document analysis to the server without having to bring documents to the client. |
| Comment by Piyush Verma [ 02/Nov/12 ] |
|
https://jira.mongodb.org/browse/SERVER-786 Seems Related. |
| Comment by Piyush Verma [ 02/Nov/12 ] |
|
Aggregation framework would mean doing a project and looping over all the elements. Although this would happen server side, it aint be as fast as just reading the length (MetaData) of an Array. Example use case:= |
| Comment by Scott Hernandez (Inactive) [ 27/Nov/11 ] |
|
The new aggregation framework will have support for these types of aggregations, and transformations: |
| Comment by Alexander Slepoy [ 27/Nov/11 ] |
|
In addition to size will be nice to add $avg(array.field), $min(array.field), $max(array.field) it would be used for different cases. |