diff options
author | 2020-11-18 23:26:45 +0100 | |
---|---|---|
committer | 2020-11-18 23:26:45 +0100 | |
commit | 81ddf9b700bc48a1f8e472209f080f9c1d9a9b09 (patch) | |
tree | 8b959d50c5a614cbf9fcb346ed556140374d4b6d /node_modules/mongodb/lib/operations/distinct.js | |
parent | 1870f3fdf43707a15fda0f609a021f516f45eb63 (diff) | |
download | website_creator-81ddf9b700bc48a1f8e472209f080f9c1d9a9b09.tar.gz website_creator-81ddf9b700bc48a1f8e472209f080f9c1d9a9b09.tar.bz2 website_creator-81ddf9b700bc48a1f8e472209f080f9c1d9a9b09.zip |
rm node_modules
Diffstat (limited to 'node_modules/mongodb/lib/operations/distinct.js')
-rw-r--r-- | node_modules/mongodb/lib/operations/distinct.js | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/node_modules/mongodb/lib/operations/distinct.js b/node_modules/mongodb/lib/operations/distinct.js deleted file mode 100644 index dcf4f7e..0000000 --- a/node_modules/mongodb/lib/operations/distinct.js +++ /dev/null @@ -1,85 +0,0 @@ -'use strict'; - -const Aspect = require('./operation').Aspect; -const defineAspects = require('./operation').defineAspects; -const CommandOperationV2 = require('./command_v2'); -const decorateWithCollation = require('../utils').decorateWithCollation; -const decorateWithReadConcern = require('../utils').decorateWithReadConcern; - -/** - * Return a list of distinct values for the given key across a collection. - * - * @class - * @property {Collection} a Collection instance. - * @property {string} key Field of the document to find distinct values for. - * @property {object} query The query for filtering the set of documents to which we apply the distinct filter. - * @property {object} [options] Optional settings. See Collection.prototype.distinct for a list of options. - */ -class DistinctOperation extends CommandOperationV2 { - /** - * Construct a Distinct operation. - * - * @param {Collection} a Collection instance. - * @param {string} key Field of the document to find distinct values for. - * @param {object} query The query for filtering the set of documents to which we apply the distinct filter. - * @param {object} [options] Optional settings. See Collection.prototype.distinct for a list of options. - */ - constructor(collection, key, query, options) { - super(collection, options); - - this.collection = collection; - this.key = key; - this.query = query; - } - - /** - * Execute the operation. - * - * @param {Collection~resultCallback} [callback] The command result callback - */ - execute(server, callback) { - const coll = this.collection; - const key = this.key; - const query = this.query; - const options = this.options; - - // Distinct command - const cmd = { - distinct: coll.collectionName, - key: key, - query: query - }; - - // Add maxTimeMS if defined - if (typeof options.maxTimeMS === 'number') { - cmd.maxTimeMS = options.maxTimeMS; - } - - // Do we have a readConcern specified - decorateWithReadConcern(cmd, coll, options); - - // Have we specified collation - try { - decorateWithCollation(cmd, coll, options); - } catch (err) { - return callback(err, null); - } - - super.executeCommand(server, cmd, (err, result) => { - if (err) { - callback(err); - return; - } - - callback(null, this.options.full ? result : result.values); - }); - } -} - -defineAspects(DistinctOperation, [ - Aspect.READ_OPERATION, - Aspect.RETRYABLE, - Aspect.EXECUTE_WITH_SELECTION -]); - -module.exports = DistinctOperation; |