File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -1209,6 +1209,7 @@ export const OPTIONS = {
1209
1209
}
1210
1210
} as OptionDescriptor ,
1211
1211
wtimeoutMS : {
1212
+ deprecated : 'Please use timeoutMS instead' ,
1212
1213
target : 'writeConcern' ,
1213
1214
transform ( { values : [ value ] , options } ) {
1214
1215
const wc = WriteConcern . fromOptions ( {
Original file line number Diff line number Diff line change @@ -556,6 +556,14 @@ export function resolveOptions<T extends CommandOperationOptions>(
556
556
}
557
557
558
558
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
+ }
559
567
560
568
return result ;
561
569
}
You can’t perform that action at this time.
0 commit comments