[SERVER-18208] Allow Queries to find ARRAY sizes Created: 25/Apr/15  Updated: 16/May/15  Resolved: 15/May/15

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: Yair Lenga Assignee: Ramon Fernandez Marina
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-18210 Add query for document structure Closed
Participants:

 Description   

Please As an alternative (or in addition), the actual size of the array should be returned.

Motivation:
Related to SERVER-18207:
Our application parses data from MongoDB repositories that are populated by other application. Documents can have potentially large ARRAYS objects at arbitrary points. The application retrieve the data, present the user with "summary" (e.g., show the first 3 values of each array followed by "..."). The full array is displayed once the user choose a specific document, and part of the document.

The above change will allow the application to locate all the arrays in a specific document, and form queries for the required amount of data (using array slices) from each array.



 Comments   
Comment by Yair Lenga [ 16/May/15 ]

Posted comment to reconsider on SERVER-18209

Regards,
Yair

Comment by Ramon Fernandez Marina [ 15/May/15 ]

yair.lenga@gmail.com, this ticket also looks like a subset of the functionality requested in SERVER-18210 / SERVER-13447, so I'm going to fold this ticket into SERVER-18210.

Regards,
Ramón.

Comment by Yair Lenga [ 25/Apr/15 ]

For the application to use the '$size', it need to know the location and the name of of the attribute where the array is stored.

In the case that the database is extended on a regular basis, taking advantage of the MongoDB ability to extend the document dynamically, the reading application does not know where the large arrays are located.

Having the ability to find out where the arrays are located, and their sizes, using the above feature, will make it possible for the application to identify the arrays and their sizes, and decide on which subset of arrays/indices to retrieve.

Comment by Ramon Fernandez Marina [ 25/Apr/15 ]

yair.lenga@gmail.com, you can already get the size of an array using a simple, one-stage aggregation pipeline – please take a look at the $size operator for a description and a short example. Can you please try this out and see if it meets your needs?

Thanks,
Ramón.

Generated at Thu Feb 08 03:46:53 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.