Skip to content

Commit 12c6835

Browse files
fix(NODE-3878): use legacy count operation on collection.count (#3126)
1 parent e41f5bb commit 12c6835

File tree

5 files changed

+7
-13
lines changed

5 files changed

+7
-13
lines changed

src/collection.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import type {
2121
import type { AggregateOptions } from './operations/aggregate';
2222
import { BulkWriteOperation } from './operations/bulk_write';
2323
import type { IndexInformationOptions } from './operations/common_functions';
24-
import type { CountOptions } from './operations/count';
24+
import { CountOperation, CountOptions } from './operations/count';
2525
import { CountDocumentsOperation, CountDocumentsOptions } from './operations/count_documents';
2626
import {
2727
DeleteManyOperation,
@@ -1637,7 +1637,11 @@ export class Collection<TSchema extends Document = Document> {
16371637
filter ??= {};
16381638
return executeOperation(
16391639
getTopology(this),
1640-
new CountDocumentsOperation(this as TODO_NODE_3286, filter, resolveOptions(this, options)),
1640+
new CountOperation(
1641+
MongoDBNamespace.fromString(this.namespace),
1642+
filter,
1643+
resolveOptions(this, options)
1644+
),
16411645
callback
16421646
);
16431647
}

test/integration/client-side-encryption/client_side_encryption.spec.test.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ describe('Client Side Encryption', function () {
3535
});
3636

3737
generateTopologyTests(testSuites, testContext, spec => {
38-
return (
39-
!spec.description.match(/type=symbol/) &&
40-
!spec.description.match(/maxWireVersion < 8/) &&
41-
!spec.description.match(/Count with deterministic encryption/) // TODO(NODE-3369): Unskip
42-
);
38+
return !spec.description.match(/type=symbol/) && !spec.description.match(/maxWireVersion < 8/);
4339
});
4440
});

test/integration/command-monitoring/command_monitoring.spec.test.js

-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,6 @@ describe('Command Monitoring spec tests', function () {
240240
}
241241

242242
loadSpecTests('command-monitoring/legacy').forEach(scenario => {
243-
if (scenario.name === 'command') return; // TODO(NODE-3369): remove when `count` spec tests have been fixed
244243
describe(scenario.name, function () {
245244
scenario.tests.forEach(test => {
246245
const requirements = { topology: ['single', 'replicaset', 'sharded'] };

test/integration/retryable-reads/retryable_reads.spec.test.js

-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ describe('Retryable Reads', function () {
2323
spec.description.match(/listCollections/i) ||
2424
spec.description.match(/listCollectionNames/i) ||
2525
spec.description.match(/estimatedDocumentCount/i) ||
26-
// FIXME(NODE-3369): uncomment when `count` spec tests have been fixed
27-
// spec.description.match(/count/i) ||
2826
spec.description.match(/find/i)
2927
);
3028
});

test/integration/transactions/transactions.spec.test.js

-3
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,6 @@ const SKIP_TESTS = [
8888
'commitTransaction retry fails on new mongos',
8989
'unpin after transient error within a transaction and commit',
9090

91-
// TODO(NODE-3369): unskip count tests when spec tests have been updated
92-
'count',
93-
9491
// TODO(NODE-2034): Will be implemented as part of NODE-2034
9592
'Client side error in command starting transaction',
9693
'Client side error when transaction is in progress'

0 commit comments

Comments
 (0)