Skip to content

Commit

Permalink
feat(NODE-3914): deprecate legacy timeout options
Browse files Browse the repository at this point in the history
  • Loading branch information
W-A-James committed Oct 15, 2024
1 parent 450b163 commit 6686768
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/connection_string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
8 changes: 8 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,14 @@ export function resolveOptions<T extends CommandOperationOptions>(
}

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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)'
};
Expand Down

0 comments on commit 6686768

Please sign in to comment.