Skip to content

Commit 6686768

Browse files
committed
feat(NODE-3914): deprecate legacy timeout options
1 parent 450b163 commit 6686768

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

src/connection_string.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,6 +1209,7 @@ export const OPTIONS = {
12091209
}
12101210
} as OptionDescriptor,
12111211
wtimeoutMS: {
1212+
deprecated: 'Please use timeoutMS instead',
12121213
target: 'writeConcern',
12131214
transform({ values: [value], options }) {
12141215
const wc = WriteConcern.fromOptions({

src/utils.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,14 @@ export function resolveOptions<T extends CommandOperationOptions>(
569569
}
570570

571571
result.timeoutMS = options?.timeoutMS ?? parent?.timeoutMS;
572+
if (result.timeoutMS != null && result.writeConcern) {
573+
const matchOptions = new Set(['wtimeout', 'wtimeoutMS']);
574+
console.log(result.writeConcern);
575+
const writeConcernKeys = Object.keys(result.writeConcern);
576+
if (writeConcernKeys.length <= 2 && writeConcernKeys.every(k => matchOptions.has(k))) {
577+
delete result.writeConcern;
578+
}
579+
}
572580

573581
return result;
574582
}

test/integration/client-side-operations-timeout/client_side_operations_timeout.spec.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { runUnifiedSuite } from '../../tools/unified-spec-runner/runner';
77
const skippedSpecs = {
88
'change-streams': 'TODO(NODE-6035)',
99
'convenient-transactions': 'TODO(NODE-5687)',
10-
'deprecated-options': 'TODO(NODE-5689)',
1110
'tailable-awaitData': 'TODO(NODE-6035)',
1211
'tailable-non-awaitData': 'TODO(NODE-6035)'
1312
};

0 commit comments

Comments
 (0)