diff --git a/src/connection_string.ts b/src/connection_string.ts index 2bf1f6dd193..82ff04ce243 100644 --- a/src/connection_string.ts +++ b/src/connection_string.ts @@ -1209,6 +1209,7 @@ export const OPTIONS = { } } as OptionDescriptor, wtimeoutMS: { + deprecated: 'Please use timeoutMS instead', target: 'writeConcern', transform({ values: [value], options }) { const wc = WriteConcern.fromOptions({ diff --git a/src/utils.ts b/src/utils.ts index 15b3bab90f3..6146fe3995f 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -569,6 +569,14 @@ export function resolveOptions( } result.timeoutMS = options?.timeoutMS ?? parent?.timeoutMS; + if (result.timeoutMS != null && result.writeConcern) { + const matchOptions = new Set(['wtimeout', 'wtimeoutMS']); + console.log(result.writeConcern); + const writeConcernKeys = Object.keys(result.writeConcern); + if (writeConcernKeys.length <= 2 && writeConcernKeys.every(k => matchOptions.has(k))) { + delete result.writeConcern; + } + } return result; } diff --git a/test/integration/client-side-operations-timeout/client_side_operations_timeout.spec.test.ts b/test/integration/client-side-operations-timeout/client_side_operations_timeout.spec.test.ts index c519da8039f..6708d7da89f 100644 --- a/test/integration/client-side-operations-timeout/client_side_operations_timeout.spec.test.ts +++ b/test/integration/client-side-operations-timeout/client_side_operations_timeout.spec.test.ts @@ -7,7 +7,6 @@ import { runUnifiedSuite } from '../../tools/unified-spec-runner/runner'; const skippedSpecs = { 'change-streams': 'TODO(NODE-6035)', 'convenient-transactions': 'TODO(NODE-5687)', - 'deprecated-options': 'TODO(NODE-5689)', 'tailable-awaitData': 'TODO(NODE-6035)', 'tailable-non-awaitData': 'TODO(NODE-6035)' };