[SERVER-6885] Output of show dbs should look nicer (fixed width or smarter spacing) Created: 29/Aug/12  Updated: 11/Jul/16  Resolved: 14/Mar/13

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: 2.2.0
Fix Version/s: 2.5.0

Type: Improvement Priority: Trivial - P5
Reporter: Tyler Brock Assignee: Tyler Brock
Resolution: Done Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

When users run "show dbs" it looks like a jumble of text. I think there is a tab in between the name and size but it should either not show the size or make it look nicer.

> show dbs
admin	0.203125GB
aggdb	0.203125GB
config	0.203125GB
config_backup	0.953125GB
digg	0.203125GB
dispatch_database	0.453125GB
du-manager	0.203125GB
local	(empty)
mydb	0.203125GB
somedb	0.203125GB
test	0.203125GB
training	0.203125GB
tumblelog_development	0.203125GB
twitter	0.453125GB



 Comments   
Comment by Tyler Brock [ 14/Mar/13 ]

Was using this to test in case anyone ever looks at this again.

Mongo.prototype.getDBs = function(){
    return {
        databases: [
            {name: "test1", sizeOnDisk: 2222222222222},
            {name: "test", sizeOnDisk: 23222},
            {name: "tes21-3333-23t2", sizeOnDisk: 0},
            {name: "te", sizeOnDisk: 111111},
            {name: "teasssssst4", sizeOnDisk: 23232322222}]
    };
};

Comment by auto [ 14/Mar/13 ]

Author:

{u'date': u'2013-03-14T16:58:08Z', u'name': u'Tyler Brock', u'email': u'tyler.brock@gmail.com'}

Message: SERVER-6885 make output of show dbs nicer

Apply proper padding to align and right justify size
Truncate database size output to MB

Signed-off-by: Ian Whalen <ian.whalen@gmail.com>
Branch: master
https://github.com/mongodb/mongo/commit/7b9e52dad3b7a067230836b13e89690c48ad91e4

Comment by Tyler Brock [ 14/Mar/13 ]

http://codereview.10gen.com/9831004/

Comment by Tyler Brock [ 04/Sep/12 ]

Another idea is we could return a json object that has

{ "db_name": size, "db_name": size,... }

instead?

Comment by Tyler Brock [ 04/Sep/12 ]

I'd like to add, when a new user looks at MongoDB, in a training for example, this is usually the very first thing they see. I think fixing it would go a long way towards making the experience better.

Comment by Tyler Brock [ 04/Sep/12 ]

Hey Tad, that would be awesome. I think keeping it in GB makes sense but cutting it off at MB in terms of the decimal is a fantastic idea.

Comment by Tad Marshall [ 29/Aug/12 ]

Yes, this is coming from JavaScript that has processed a listDatabases result, so it's just a shell helper that would need attention. We could even convert "0.203125GB" to MB and round it off to a smaller number of decimal places.

Generated at Thu Feb 08 03:13:00 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.