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

document level stats



    • New Feature
    • Status: Backlog
    • Minor - P4
    • Resolution: Unresolved
    • 2.3.0
    • None
    • Admin, Storage


      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):


      • 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:




      • 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.


        Issue Links



              backlog-query-execution Backlog - Query Execution
              mattcampbell Matt Campbell
              1 Vote for this issue
              12 Start watching this issue