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 = {
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 ( {
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments