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

Do not scale avgObjSize in db.stats() for mongos to be consistent with mongod

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Trivial - P5 Trivial - P5
    • 2.3.2
    • Affects Version/s: 2.2.0
    • Component/s: Diagnostics
    • ALL

      db.stats() returns the same avgObjSize regardless of scale value passed.
      The help string for db.stats() does not state the behaviour of the scale value on avgObjSize, but the documentation project states that it is affected by the scale value.
      Confusingly, db.collection.stats()'s version of avgObjSize DOES scale according to the value passed. This is incorrect the help string for the function, but correct according to the documentation project.

      http://docs.mongodb.org/manual/reference/database-statistics/

      > db.stats(1024)
      {
      	"db" : "test",
      	"collections" : 4,
      	"objects" : 11,
      	"avgObjSize" : 55.27272727272727,
      	"dataSize" : 0,
      	"storageSize" : 16,
      	"numExtents" : 4,
      	"indexes" : 3,
      	"indexSize" : 23,
      	"fileSize" : 196608,
      	"nsSizeMB" : 16,
      	"ok" : 1
      }
      > db.stats()
      {
      	"db" : "test",
      	"collections" : 4,
      	"objects" : 11,
      	"avgObjSize" : 55.27272727272727,
      	"dataSize" : 608,
      	"storageSize" : 16384,
      	"numExtents" : 4,
      	"indexes" : 3,
      	"indexSize" : 24544,
      	"fileSize" : 201326592,
      	"nsSizeMB" : 16,
      	"ok" : 1
      }
      

            Assignee:
            sverch Shaun Verch
            Reporter:
            nifrith Matthew Darby
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: