summaryrefslogtreecommitdiffstats
path: root/node_modules/mongodb/lib/operations/count.js
diff options
context:
space:
mode:
authorGravatar Piotr Russ <mail@pruss.it> 2020-11-18 23:26:45 +0100
committerGravatar Piotr Russ <mail@pruss.it> 2020-11-18 23:26:45 +0100
commit81ddf9b700bc48a1f8e472209f080f9c1d9a9b09 (patch)
tree8b959d50c5a614cbf9fcb346ed556140374d4b6d /node_modules/mongodb/lib/operations/count.js
parent1870f3fdf43707a15fda0f609a021f516f45eb63 (diff)
downloadwebsite_creator-81ddf9b700bc48a1f8e472209f080f9c1d9a9b09.tar.gz
website_creator-81ddf9b700bc48a1f8e472209f080f9c1d9a9b09.tar.bz2
website_creator-81ddf9b700bc48a1f8e472209f080f9c1d9a9b09.zip
rm node_modules
Diffstat (limited to 'node_modules/mongodb/lib/operations/count.js')
-rw-r--r--node_modules/mongodb/lib/operations/count.js68
1 files changed, 0 insertions, 68 deletions
diff --git a/node_modules/mongodb/lib/operations/count.js b/node_modules/mongodb/lib/operations/count.js
deleted file mode 100644
index a7216d6..0000000
--- a/node_modules/mongodb/lib/operations/count.js
+++ /dev/null
@@ -1,68 +0,0 @@
-'use strict';
-
-const buildCountCommand = require('./common_functions').buildCountCommand;
-const OperationBase = require('./operation').OperationBase;
-
-class CountOperation extends OperationBase {
- constructor(cursor, applySkipLimit, options) {
- super(options);
-
- this.cursor = cursor;
- this.applySkipLimit = applySkipLimit;
- }
-
- execute(callback) {
- const cursor = this.cursor;
- const applySkipLimit = this.applySkipLimit;
- const options = this.options;
-
- if (applySkipLimit) {
- if (typeof cursor.cursorSkip() === 'number') options.skip = cursor.cursorSkip();
- if (typeof cursor.cursorLimit() === 'number') options.limit = cursor.cursorLimit();
- }
-
- // Ensure we have the right read preference inheritance
- if (options.readPreference) {
- cursor.setReadPreference(options.readPreference);
- }
-
- if (
- typeof options.maxTimeMS !== 'number' &&
- cursor.cmd &&
- typeof cursor.cmd.maxTimeMS === 'number'
- ) {
- options.maxTimeMS = cursor.cmd.maxTimeMS;
- }
-
- let finalOptions = {};
- finalOptions.skip = options.skip;
- finalOptions.limit = options.limit;
- finalOptions.hint = options.hint;
- finalOptions.maxTimeMS = options.maxTimeMS;
-
- // Command
- finalOptions.collectionName = cursor.namespace.collection;
-
- let command;
- try {
- command = buildCountCommand(cursor, cursor.cmd.query, finalOptions);
- } catch (err) {
- return callback(err);
- }
-
- // Set cursor server to the same as the topology
- cursor.server = cursor.topology.s.coreTopology;
-
- // Execute the command
- cursor.topology.command(
- cursor.namespace.withCollection('$cmd'),
- command,
- cursor.options,
- (err, result) => {
- callback(err, result ? result.result.n : null);
- }
- );
- }
-}
-
-module.exports = CountOperation;