Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-4376

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

    Details

    • Backwards Compatibility:
      Fully Compatible

      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
        alexz75 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
        alexz75 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
        scotthernandez Scott Hernandez added a comment -

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

        Show
        scotthernandez Scott Hernandez added a comment - The new aggregation framework will have support for these types of aggregations, and transformations: SERVER-447
        Hide
        meson10 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
        meson10 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
        meson10 Piyush Verma added a comment -
        Show
        meson10 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:
              2 years, 35 weeks, 2 days ago
              Date of 1st Reply: