Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(NODE-3878): use legacy count operation on collection.count #3126

Merged
merged 2 commits into from
Feb 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/collection.ts
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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/);
});
});
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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