rs.slaveOk();
|
print("totaling database size")
|
var totalSize = 0
|
db.getMongo().getDBNames().forEach(function (d) {
|
print("Database: " + d );
|
var curr_db = db.getSiblingDB(d);
|
//printjson( curr_db.stats() );
|
curr_db.getCollectionNames().forEach(function(coll) {
|
print(".. collection: " + coll );
|
var c = curr_db.getCollection(coll);
|
if ( typeof c != "function") {
|
var collSize = c.totalSize()
|
print(".. size: " + collSize)
|
totalSize += collSize
|
}
|
});
|
});
|
print("totalsize: " + totalSize)
|
Tuesday, January 12, 2016
Script to get the total data size on Mongo DB
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment