@@ -58,7 +58,7 @@ type ResultTypeFromOperation<TOperation> =
5858export async function executeOperation <
5959 T extends AbstractOperation < TResult > ,
6060 TResult = ResultTypeFromOperation < T >
61- > ( client : MongoClient , operation : T , timeoutContext ?: TimeoutContext ) : Promise < TResult > {
61+ > ( client : MongoClient , operation : T , timeoutContext ?: TimeoutContext | null ) : Promise < TResult > {
6262 if ( ! ( operation instanceof AbstractOperation ) ) {
6363 // TODO(NODE-3483): Extend MongoRuntimeError
6464 throw new MongoRuntimeError ( 'This method requires a valid operation instance' ) ;
@@ -81,11 +81,6 @@ export async function executeOperation<
8181 } else if ( session . client !== client ) {
8282 throw new MongoInvalidArgumentError ( 'ClientSession must be from the same MongoClient' ) ;
8383 }
84- if ( session . explicit && session ?. timeoutMS != null && operation . options . timeoutMS != null ) {
85- throw new MongoInvalidArgumentError (
86- 'Do not specify timeoutMS on operation if already specified on an explicit session'
87- ) ;
88- }
8984
9085 const readPreference = operation . readPreference ?? ReadPreference . primary ;
9186 const inTransaction = ! ! session ?. inTransaction ( ) ;
@@ -107,6 +102,7 @@ export async function executeOperation<
107102 }
108103
109104 timeoutContext ??= TimeoutContext . create ( {
105+ session,
110106 serverSelectionTimeoutMS : client . s . options . serverSelectionTimeoutMS ,
111107 waitQueueTimeoutMS : client . s . options . waitQueueTimeoutMS ,
112108 timeoutMS : operation . options . timeoutMS
0 commit comments