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

document level stats

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Minor - P4
    • Resolution: Unresolved
    • Affects Version/s: 2.3.0
    • Fix Version/s: Backlog
    • Component/s: Admin, Storage
    • Labels:

      Description

      Implement stats similar to those found on the db and col levels.

      Currently there is no efficient way of obtaining stats such as the size of a document without sending the document down the wire to the client and bson encoding the document.

      Suggest storing document stats as meta data beside each document in a collection but only return such stats data when requested as shown in the following examples.

      Return a summary (aggregation of stats):

      db.col.findOne({}).stats();
      db.col.find({}).stats();

      • would return a document similar to db.stats() and col.stats() and contain an aggregation of all documents in the server cursor
      • in the case of findOne it would represent the stats of a single document because only one document in the cursor (thus by implementing it at the cursor level it covers both single document and aggregation scenarios)

      Return documents and stats embedded using a flag on the find() operation:

      db.col.find({},

      {stats:true}

      );

      • stats could be attached as an embedded document in the _stats key on each document
      • as the stats would be located beside the document on disk it should be a quick and efficient operation to perform

      As you can see from the examples above this would be best implemented on the server cursor. I would suggest storing stats meta data beside documents on disk as opposed to storing them in a separate hash table or other data structure. This is to ensure efficient retrievals of both documents and stats in a flexible manner and to ensure writes remain fast.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              backlog-server-query Backlog - Query Team
              Reporter:
              mattcampbell Matt Campbell
              Participants:
              Votes:
              1 Vote for this issue
              Watchers:
              12 Start watching this issue

                Dates

                Created:
                Updated: