August 24, 2011

Some simple database collection stats from MongoDB

use test
load("mongo.js")
var stats = db.runCommand( { dbStats : 1 } );
msg = "Collections " + stats.collections + "\n" +
         "DataSize " + stats.dataSize + "\n" +
         "Indexes " + stats.indexes + "\n" +
         "IndexSize " + stats.indexSize;
print(msg);

No comments:

Post a Comment