diff options
Diffstat (limited to 'src/mongo/shell/db.js')
-rw-r--r-- | src/mongo/shell/db.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/mongo/shell/db.js b/src/mongo/shell/db.js index 7a30fd09477..a1e8fb59483 100644 --- a/src/mongo/shell/db.js +++ b/src/mongo/shell/db.js @@ -36,8 +36,19 @@ DB.prototype.getName = function() { return this._name; }; -DB.prototype.stats = function(scale) { - return this.runCommand({dbstats: 1, scale: scale}); +/** + * Gets DB level statistics. opt can be a number representing the scale for backwards compatibility + * or a document with options passed along to the dbstats command. + */ +DB.prototype.stats = function(opt) { + var cmd = {dbstats: 1}; + + if (opt === undefined) + return this.runCommand(cmd); + if (typeof (opt) !== "object") + return this.runCommand(Object.extend(cmd, {scale: opt})); + + return this.runCommand(Object.extend(cmd, opt)); }; DB.prototype.getCollection = function(name) { |