Core Server
  1. Core Server
  2. SERVER-4376

Determining array and document size (number of keys) without loading document to client

    Details

    • Backport:
      No
    • Backward Breaking:
      No
    • # Replies:
      4
    • Last comment by Customer:
      true

      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.
      I actually wrote this request after I've read someone other's message in mongodb-user: http://groups.google.com/group/mongodb-user/browse_thread/thread/159eecb36444f402 and understood that I'm not the only one with such needs.

        Activity

        Hide
        Alexander Slepoy
        added a comment -

        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.

        Show
        Alexander Slepoy
        added a comment - 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.
        Hide
        Scott Hernandez
        added a comment -

        The new aggregation framework will have support for these types of aggregations, and transformations: SERVER-447

        Show
        Scott Hernandez
        added a comment - The new aggregation framework will have support for these types of aggregations, and transformations: SERVER-447
        Hide
        Piyush Verma
        added a comment -

        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.
        Using aggregation framework for size would defeat the purpose.

        Example use case:=
        I want to query for Comments only if the size of comment_ids array is > 0
        With Aggregation Framework I would query the comments and then return them If the length is > 0. I might as well fetch the entire data and do it client Side.

        Show
        Piyush Verma
        added a comment - 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. Using aggregation framework for size would defeat the purpose. Example use case:= I want to query for Comments only if the size of comment_ids array is > 0 With Aggregation Framework I would query the comments and then return them If the length is > 0. I might as well fetch the entire data and do it client Side.
        Hide
        Piyush Verma
        added a comment -
        Show
        Piyush Verma
        added a comment - https://jira.mongodb.org/browse/SERVER-786 Seems Related.

          People

          • Votes:
            7 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

            • Created:
              Updated:
              Days since reply:
              1 year, 24 weeks, 1 day ago
              Date of 1st Reply: