Skip to content

Commit

Permalink
fix(NODE-3878): use legacy count operation on collection.count (#3126)
Browse files Browse the repository at this point in the history
  • Loading branch information
baileympearson committed Feb 7, 2022
1 parent e41f5bb commit 12c6835
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 13 deletions.
8 changes: 6 additions & 2 deletions src/collection.ts
Expand Up @@ -21,7 +21,7 @@ import type {
import type { AggregateOptions } from './operations/aggregate';
import { BulkWriteOperation } from './operations/bulk_write';
import type { IndexInformationOptions } from './operations/common_functions';
import type { CountOptions } from './operations/count';
import { CountOperation, CountOptions } from './operations/count';
import { CountDocumentsOperation, CountDocumentsOptions } from './operations/count_documents';
import {
DeleteManyOperation,
Expand Down Expand Up @@ -1637,7 +1637,11 @@ export class Collection<TSchema extends Document = Document> {
filter ??= {};
return executeOperation(
getTopology(this),
new CountDocumentsOperation(this as TODO_NODE_3286, filter, resolveOptions(this, options)),
new CountOperation(
MongoDBNamespace.fromString(this.namespace),
filter,
resolveOptions(this, options)
),
callback
);
}
Expand Down
Expand Up @@ -35,10 +35,6 @@ describe('Client Side Encryption', function () {
});

generateTopologyTests(testSuites, testContext, spec => {
return (
!spec.description.match(/type=symbol/) &&
!spec.description.match(/maxWireVersion < 8/) &&
!spec.description.match(/Count with deterministic encryption/) // TODO(NODE-3369): Unskip
);
return !spec.description.match(/type=symbol/) && !spec.description.match(/maxWireVersion < 8/);
});
});
Expand Up @@ -240,7 +240,6 @@ describe('Command Monitoring spec tests', function () {
}

loadSpecTests('command-monitoring/legacy').forEach(scenario => {
if (scenario.name === 'command') return; // TODO(NODE-3369): remove when `count` spec tests have been fixed
describe(scenario.name, function () {
scenario.tests.forEach(test => {
const requirements = { topology: ['single', 'replicaset', 'sharded'] };
Expand Down
2 changes: 0 additions & 2 deletions test/integration/retryable-reads/retryable_reads.spec.test.js
Expand Up @@ -23,8 +23,6 @@ describe('Retryable Reads', function () {
spec.description.match(/listCollections/i) ||
spec.description.match(/listCollectionNames/i) ||
spec.description.match(/estimatedDocumentCount/i) ||
// FIXME(NODE-3369): uncomment when `count` spec tests have been fixed
// spec.description.match(/count/i) ||
spec.description.match(/find/i)
);
});
Expand Down
3 changes: 0 additions & 3 deletions test/integration/transactions/transactions.spec.test.js
Expand Up @@ -88,9 +88,6 @@ const SKIP_TESTS = [
'commitTransaction retry fails on new mongos',
'unpin after transient error within a transaction and commit',

// TODO(NODE-3369): unskip count tests when spec tests have been updated
'count',

// TODO(NODE-2034): Will be implemented as part of NODE-2034
'Client side error in command starting transaction',
'Client side error when transaction is in progress'
Expand Down

0 comments on commit 12c6835

Please sign in to comment.