display both redis/mongo info if available

This commit is contained in:
barisusakli
2015-05-08 15:36:06 -04:00
parent 0083d4ff1c
commit 7b550b13b9
6 changed files with 96 additions and 54 deletions

View File

@@ -158,6 +158,24 @@
});
};
module.info = function(db, callback) {
db.stats({scale:1024}, function(err, stats) {
if(err) {
return callback(err);
}
stats.avgObjSize = (stats.avgObjSize / 1024).toFixed(2);
stats.dataSize = (stats.dataSize / 1024).toFixed(2);
stats.storageSize = (stats.storageSize / 1024).toFixed(2);
stats.fileSize = (stats.fileSize / 1024).toFixed(2);
stats.indexSize = (stats.indexSize / 1024).toFixed(2);
stats.raw = JSON.stringify(stats, null, 4);
stats.mongo = true;
callback(null, stats);
});
};
module.close = function() {
db.close();
};