MongoDB服务端JavaScript脚本
db.system.js.remove({"_id":"dbaStatCollections"});db.system.js.save(
{
_id : "dbaStatCollections" ,
value : function () {
collNames = db.getCollectionNames();
for (var index = 0; index < collNames.length; index++) {
var coll = db.getCollection(collNames);
var stats = coll.stats();
print('ns,count,size,totalIndexSize');
print(stats.ns + ',' + stats.count + ',' + stats.size + ',' + stats.totalIndexSize);
}
}
}
);
db.loadServerScripts();
dbaStatCollections();
页:
[1]