Skip to content

Commit 8b61a64

Browse files
committed
WIP
1 parent 1a1d7cc commit 8b61a64

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
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
@@ -556,6 +556,14 @@ export function resolveOptions<T extends CommandOperationOptions>(
556556
}
557557

558558
result.timeoutMS = options?.timeoutMS ?? parent?.timeoutMS;
559+
if (result.timeoutMS != null && result.writeConcern) {
560+
const matchOptions = new Set(['wtimeout', 'wtimeoutMS']);
561+
console.log(result.writeConcern);
562+
const writeConcernKeys = Object.keys(result.writeConcern);
563+
if (writeConcernKeys.length <= 2 && writeConcernKeys.every(k => matchOptions.has(k))) {
564+
delete result.writeConcern;
565+
}
566+
}
559567

560568
return result;
561569
}

0 commit comments

Comments
 (0)