summaryrefslogtreecommitdiffstats
path: root/node_modules/mongodb/lib/operations/stats.js
diff options
context:
space:
mode:
authorGravatar Piotr Russ <mail@pruss.it> 2020-11-16 00:10:28 +0100
committerGravatar Piotr Russ <mail@pruss.it> 2020-11-16 00:10:28 +0100
commite06ec920f7a5d784e674c4c4b4e6d1da3dc7391d (patch)
tree55713f725f77b44ebfec86e4eec3ce33e71458ca /node_modules/mongodb/lib/operations/stats.js
downloadwebsite_creator-e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d.tar.gz
website_creator-e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d.tar.bz2
website_creator-e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d.zip
api, login, auth
Diffstat (limited to 'node_modules/mongodb/lib/operations/stats.js')
-rw-r--r--node_modules/mongodb/lib/operations/stats.js45
1 files changed, 45 insertions, 0 deletions
diff --git a/node_modules/mongodb/lib/operations/stats.js b/node_modules/mongodb/lib/operations/stats.js
new file mode 100644
index 0000000..ff79126
--- /dev/null
+++ b/node_modules/mongodb/lib/operations/stats.js
@@ -0,0 +1,45 @@
+'use strict';
+
+const Aspect = require('./operation').Aspect;
+const CommandOperation = require('./command');
+const defineAspects = require('./operation').defineAspects;
+
+/**
+ * Get all the collection statistics.
+ *
+ * @class
+ * @property {Collection} a Collection instance.
+ * @property {object} [options] Optional settings. See Collection.prototype.stats for a list of options.
+ */
+class StatsOperation extends CommandOperation {
+ /**
+ * Construct a Stats operation.
+ *
+ * @param {Collection} a Collection instance.
+ * @param {object} [options] Optional settings. See Collection.prototype.stats for a list of options.
+ */
+ constructor(collection, options) {
+ super(collection.s.db, options, collection);
+ }
+
+ _buildCommand() {
+ const collection = this.collection;
+ const options = this.options;
+
+ // Build command object
+ const command = {
+ collStats: collection.collectionName
+ };
+
+ // Check if we have the scale value
+ if (options['scale'] != null) {
+ command['scale'] = options['scale'];
+ }
+
+ return command;
+ }
+}
+
+defineAspects(StatsOperation, Aspect.READ_OPERATION);
+
+module.exports = StatsOperation;