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

document level stats

    • Type: Icon: New Feature New Feature
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.3.0
    • Component/s: Admin, Storage
    • Query Execution

      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.

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            mattcampbell Matt Campbell
            Votes:
            1 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated: