Skip to content

Commit f9d3ce0

Browse files
committed
feat(NODE-4079): estimated document count uses count
1 parent 15f8870 commit f9d3ce0

7 files changed

+167
-467
lines changed

src/operations/estimated_document_count.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ export class EstimatedDocumentCountOperation extends CommandOperation<number> {
3636
if (maxWireVersion(server) < 12) {
3737
return this.executeLegacy(server, session, callback);
3838
}
39-
const pipeline = [{ $collStats: { count: {} } }, { $group: { _id: 1, n: { $sum: '$count' } } }];
4039

41-
const cmd: Document = { aggregate: this.collectionName, pipeline, cursor: {} };
40+
const cmd: Document = { count: this.collectionName } };
4241

4342
if (typeof this.options.maxTimeMS === 'number') {
4443
cmd.maxTimeMS = this.options.maxTimeMS;

0 commit comments

Comments
 (0)