Every line of 'countdocuments mongoose' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
146 async count(collectionName: string, query?: ObjectLiteral, options?: MongoCountPreferences): Promise { 147 return await this.getCollection(collectionName).countDocuments(query || {}, options); 148 }
82 count(query, { skip, limit, sort, maxTimeMS, readPreference } = {}) { 83 // If query is empty, then use estimatedDocumentCount instead. 84 // This is due to countDocuments performing a scan, 85 // which greatly increases execution time when being run on large collections. 86 // See https://github.com/Automattic/mongoose/issues/6713 for more info regarding this problem. 87 if (typeof query !== 'object' || !Object.keys(query).length) { 88 return this._mongoCollection.estimatedDocumentCount({ 89 maxTimeMS, 90 }); 91 } 92 93 const countOperation = this._mongoCollection.countDocuments(query, { 94 skip, 95 limit, 96 sort, 97 maxTimeMS, 98 readPreference, 99 }); 100 101 return countOperation; 102 }
42 function count(db: Nedb, query?: object): Promise { 43 return new Promise((resolve, reject) => { 44 db.count(query, function(error, count) { 45 if (error) { 46 return reject( 47 `An error happened whiling handling count: ${query} - ${error}` 48 ); 49 } 50 return resolve(count); 51 }); 52 }); 53 }
179 count(conditions: any): Promise { 180 return this._model.countDocuments(conditions).exec(); 181 }
29 function counts(TableName, callback) { 30 doc.query({ 31 TableName, 32 Select: 'COUNT', 33 KeyConditionExpression: '#scopeID = :scopeID and begins_with(#dataID, :dataID)', 34 ExpressionAttributeNames: { 35 '#scopeID': 'scopeID', 36 '#dataID': 'dataID' 37 }, 38 ExpressionAttributeValues: { 39 ':scopeID': scopeID, 40 ':dataID': dataID.replace('#UNKNOWN', ''), 41 } 42 }, callback) 43 }
331 function countSearch(params) { 332 const $or = buildSearchOr(model, params._q); 333 return model.find({ $or }).countDocuments(); 334 }
3 async function count () { 4 const result = await client.count({ index, type }) 5 console.log('count', result) 6 }
230 count(table, options, where, callback) { 231 try { 232 checkParams({table, options, where, callback}) 233 } catch (err) { 234 return callback(err) 235 } 236 let _options = _.cloneDeep(options) 237 _options.castIds = false 238 this._conn.collection(table).count(where, _options, (err, count) => { 239 return callback(err, count, null) 240 }) 241 }
26 count(db: any): any { 27 return db.allDocs() 28 .then(result => result.total_rows) 29 .catch(err => err); 30 }
26 async count(): Promise { 27 return this.aidModelModel.estimatedDocumentCount().exec() 28 }