Skip to content

Commit be5f59c

Browse files
committed
simplify write concern modification logic
1 parent 6edcc1b commit be5f59c

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/utils.ts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -555,18 +555,13 @@ export function resolveOptions<T extends CommandOperationOptions>(
555555
let writeConcern = WriteConcern.fromOptions(options) ?? parent?.writeConcern;
556556
if (writeConcern) {
557557
if (timeoutMS != null) {
558-
result.writeConcern = writeConcern;
559-
} else {
560-
const matchOptions = new Set(['wtimeout', 'wtimeoutMS']);
561-
const writeConcernKeys = Object.keys(writeConcern);
562-
if (writeConcernKeys.length > 2 && writeConcernKeys.some(k => !matchOptions.has(k))) {
563-
writeConcern = WriteConcern.fromOptions({
564-
...writeConcern,
565-
wtimeout: undefined,
566-
wtimeoutMS: undefined
567-
});
568-
}
558+
writeConcern = WriteConcern.fromOptions({
559+
...writeConcern,
560+
wtimeout: undefined,
561+
wtimeoutMS: undefined
562+
});
569563
}
564+
result.writeConcern = writeConcern;
570565
}
571566
}
572567

0 commit comments

Comments
 (0)