From 81ddf9b700bc48a1f8e472209f080f9c1d9a9b09 Mon Sep 17 00:00:00 2001 From: Piotr Russ Date: Wed, 18 Nov 2020 23:26:45 +0100 Subject: rm node_modules --- node_modules/mongodb/lib/operations/count.js | 68 ---------------------------- 1 file changed, 68 deletions(-) delete mode 100644 node_modules/mongodb/lib/operations/count.js (limited to 'node_modules/mongodb/lib/operations/count.js') 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; -- cgit v1.2.3