* Get the count of documents for this cursor * @deprecated Use `collection.estimatedDocumentCount` or `collection.countDocuments` instead
(options?: CountOptions)
| 149 | * @deprecated Use `collection.estimatedDocumentCount` or `collection.countDocuments` instead |
| 150 | */ |
| 151 | async count(options?: CountOptions): Promise<number> { |
| 152 | emitWarningOnce( |
| 153 | 'cursor.count is deprecated and will be removed in the next major version, please use `collection.estimatedDocumentCount` or `collection.countDocuments` instead ' |
| 154 | ); |
| 155 | if (typeof options === 'boolean') { |
| 156 | throw new MongoInvalidArgumentError('Invalid first parameter to count'); |
| 157 | } |
| 158 | return await executeOperation( |
| 159 | this.client, |
| 160 | new CountOperation(this.namespace, this.cursorFilter, { |
| 161 | ...this.findOptions, // NOTE: order matters here, we may need to refine this |
| 162 | ...this.cursorOptions, |
| 163 | ...options |
| 164 | }) |
| 165 | ); |
| 166 | } |
| 167 | |
| 168 | /** Execute the explain for the cursor */ |
| 169 | async explain(): Promise<Document>; |
nothing calls this directly
no test coverage detected