[SERVER-2380] Make db.printCollectionStats() behave the same way as db.collection.stats() Created: 19/Jan/11  Updated: 05/Nov/15  Resolved: 31/Aug/12

Status: Closed
Project: Core Server
Component/s: JavaScript, Shell
Affects Version/s: None
Fix Version/s: 2.3.0

Type: Improvement Priority: Minor - P4
Reporter: Alvin Richards (Inactive) Assignee: Unassigned
Resolution: Done Votes: 1
Labels: helper, javascript, neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Backwards Compatibility: Fully Compatible
Participants:

 Description   

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



 Comments   
Comment by auto [ 31/Aug/12 ]

Author:

{u'date': u'2012-08-31T07:18:13-07:00', u'name': u'Ian Whalen', u'email': u'ian.whalen@gmail.com'}

Message: Merge pull request #290 from jcesareo/SERVER-2380

SERVER-2380 printCollectionStats behaves like db.collection.stats()
Branch: master
https://github.com/mongodb/mongo/commit/1a99e6cd2228c93126c5765e5136a2344c32ea2d

Comment by auto [ 31/Aug/12 ]

Author:

{u'date': u'2012-08-31T07:18:13-07:00', u'name': u'Ian Whalen', u'email': u'ian.whalen@gmail.com'}

Message: Merge pull request #290 from jcesareo/SERVER-2380

SERVER-2380 printCollectionStats behaves like db.collection.stats()
Branch: master
https://github.com/mongodb/mongo/commit/1a99e6cd2228c93126c5765e5136a2344c32ea2d

Comment by auto [ 31/Aug/12 ]

Author:

{u'date': u'2012-08-10T13:27:42-07:00', u'name': u'jcesareo', u'email': u'jacopo.cesareo@10gen.com'}

Message: SERVER-2380 printCollectionStats behaves like db.collection.stats()
Branch: master
https://github.com/mongodb/mongo/commit/1c8aa8e544e14a8107c7193d8fca86ed5f4c1d4d

Generated at Thu Feb 08 02:59:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.