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

Make db.printCollectionStats() behave the same way as db.collection.stats()

    • Fully Compatible

      Problem:

      db.collection.stats() allows you to pass in a scale, making the output easier to read, for example

      > db.blogs.stats()
      {
      "ns" : "scaleout.blogs",
      "count" : 1950437,
      "size" : 210646912,
      "avgObjSize" : 107.99985439160557,
      "storageSize" : 272485632,
      "numExtents" : 17,
      "nindexes" : 2,
      "lastExtentSize" : 51938304,
      "paddingFactor" : 1,
      "flags" : 1,
      "totalIndexSize" : 175284224,
      "indexSizes" :

      { "_id_" : 81117184, "title_1" : 94167040 }

      ,
      "ok" : 1
      }
      > db.blogs.stats(1024)
      {
      "ns" : "scaleout.blogs",
      "count" : 1950437,
      "size" : 205709,
      "avgObjSize" : 0.10546815918688991,
      "storageSize" : 266099,
      "numExtents" : 17,
      "nindexes" : 2,
      "lastExtentSize" : 50721,
      "paddingFactor" : 1,
      "flags" : 1,
      "totalIndexSize" : 171176,
      "indexSizes" :

      { "_id_" : 79216, "title_1" : 91960 }

      ,
      "ok" : 1
      }

      However, db.printCollectionStats() does not accept this scale parameter, making the output harder to read

      > db.printCollectionStats()
      blogs
      {
      "ns" : "scaleout.blogs",
      "count" : 1950437,
      "size" : 210646912,
      "avgObjSize" : 107.99985439160557,
      "storageSize" : 272485632,
      "numExtents" : 17,
      "nindexes" : 2,
      "lastExtentSize" : 51938304,
      "paddingFactor" : 1,
      "flags" : 1,
      "totalIndexSize" : 175284224,
      "indexSizes" :

      { "_id_" : 81117184, "title_1" : 94167040 }

      ,
      "ok" : 1
      }

      Solution:
      Allow db.printCollectionStats() to take a scaling argument.

      Business Case:
      Ease of use

            Assignee:
            Unassigned Unassigned
            Reporter:
            alvin Alvin Richards (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: