@@ -172,80 +172,6 @@ function checkForAtomicOperators(update) {
172
172
}
173
173
}
174
174
175
- /**
176
- * Count the number of documents in the collection that match the query.
177
- *
178
- * @method
179
- * @param {Collection } a Collection instance.
180
- * @param {object } query The query for the count.
181
- * @param {object } [options] Optional settings. See Collection.prototype.count for a list of options.
182
- * @param {Collection~countCallback } [callback] The command result callback
183
- */
184
- function count ( coll , query , options , callback ) {
185
- if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
186
- options = Object . assign ( { } , options ) ;
187
- options . collectionName = coll . collectionName ;
188
-
189
- options . readPreference = resolveReadPreference ( coll , options ) ;
190
-
191
- let cmd ;
192
- try {
193
- cmd = buildCountCommand ( coll , query , options ) ;
194
- } catch ( err ) {
195
- return callback ( err ) ;
196
- }
197
-
198
- executeCommand ( coll . s . db , cmd , options , ( err , result ) => {
199
- if ( err ) return handleCallback ( callback , err ) ;
200
- handleCallback ( callback , null , result . n ) ;
201
- } ) ;
202
- }
203
-
204
- /**
205
- * Build the count command.
206
- *
207
- * @method
208
- * @param {collectionOrCursor } an instance of a collection or cursor
209
- * @param {object } query The query for the count.
210
- * @param {object } [options] Optional settings. See Collection.prototype.count and Cursor.prototype.count for a list of options.
211
- */
212
- function buildCountCommand ( collectionOrCursor , query , options ) {
213
- const skip = options . skip ;
214
- const limit = options . limit ;
215
- let hint = options . hint ;
216
- const maxTimeMS = options . maxTimeMS ;
217
- query = query || { } ;
218
-
219
- // Final query
220
- const cmd = {
221
- count : options . collectionName ,
222
- query : query
223
- } ;
224
-
225
- // check if collectionOrCursor is a cursor by using cursor.s.numberOfRetries
226
- if ( collectionOrCursor . s . numberOfRetries ) {
227
- if ( collectionOrCursor . s . options . hint ) {
228
- hint = collectionOrCursor . s . options . hint ;
229
- } else if ( collectionOrCursor . s . cmd . hint ) {
230
- hint = collectionOrCursor . s . cmd . hint ;
231
- }
232
- decorateWithCollation ( cmd , collectionOrCursor , collectionOrCursor . s . cmd ) ;
233
- } else {
234
- decorateWithCollation ( cmd , collectionOrCursor , options ) ;
235
- }
236
-
237
- // Add limit, skip and maxTimeMS if defined
238
- if ( typeof skip === 'number' ) cmd . skip = skip ;
239
- if ( typeof limit === 'number' ) cmd . limit = limit ;
240
- if ( typeof maxTimeMS === 'number' ) cmd . maxTimeMS = maxTimeMS ;
241
- if ( hint ) cmd . hint = hint ;
242
-
243
- // Do we have a readConcern specified
244
- decorateWithReadConcern ( cmd , collectionOrCursor ) ;
245
-
246
- return cmd ;
247
- }
248
-
249
175
/**
250
176
* Create an index on the db and collection.
251
177
*
@@ -1223,8 +1149,6 @@ function updateOne(coll, filter, update, options, callback) {
1223
1149
module . exports = {
1224
1150
bulkWrite,
1225
1151
checkForAtomicOperators,
1226
- count,
1227
- buildCountCommand,
1228
1152
createIndex,
1229
1153
createIndexes,
1230
1154
deleteMany,
0 commit comments