Every line of 'mongodb aggregate count with condition' 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.
834 count (groupBy) { 835 return this._aggregate('count', null, groupBy) 836 }
522 async count(field?: string, options?: Object): Promise { 523 return super.count(field, options); 524 }
749 Model.count = function count(conditions, callback) { 750 if (typeof conditions === 'function') { 751 callback = conditions; 752 conditions = {}; 753 } 754 755 var query = new Query({}, this, {}); 756 return query.count(conditions, callback); 757 };
103 convertSimpleCondition(condition) { 104 if (typeof condition.value === 'undefined') { 105 return {}; 106 } 107 switch (condition.operator) { 108 case '=': 109 case '==': 110 return lodash_1.set({}, condition.field, condition.value); 111 case '!=': 112 case '<>': 113 return lodash_1.set({}, condition.field, { $ne: condition.value }); 114 case '<': 115 return lodash_1.set({}, condition.field, { $lt: condition.value }); 116 case '<=': 117 case '=<': 118 return lodash_1.set({}, condition.field, { $lte: condition.value }); 119 case '>': 120 return lodash_1.set({}, condition.field, { $gt: condition.value }); 121 case '>=': 122 case '=>': 123 return lodash_1.set({}, condition.field, { $gte: condition.value }); 124 case 'in': 125 return lodash_1.set({}, condition.field, { $in: condition.value }); 126 case 'not-in': 127 return lodash_1.set({}, condition.field, { $nin: condition.value }); 128 } 129 }
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 }
179 count(conditions: any): Promise { 180 return this._model.countDocuments(conditions).exec(); 181 }