Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
W-A-James committed Oct 14, 2024
1 parent 1a1d7cc commit 8b61a64
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
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 @@ -556,6 +556,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

0 comments on commit 8b61a64

Please sign in to comment.