@@ -59,7 +59,7 @@ type ResultTypeFromOperation<TOperation> = TOperation extends AbstractOperation<
5959export async function executeOperation <
6060 T extends AbstractOperation < TResult > ,
6161 TResult = ResultTypeFromOperation < T >
62- > ( client : MongoClient , operation : T , timeoutContext ?: TimeoutContext ) : Promise < TResult > {
62+ > ( client : MongoClient , operation : T , timeoutContext ?: TimeoutContext | null ) : Promise < TResult > {
6363 if ( ! ( operation instanceof AbstractOperation ) ) {
6464 // TODO(NODE-3483): Extend MongoRuntimeError
6565 throw new MongoRuntimeError ( 'This method requires a valid operation instance' ) ;
@@ -82,11 +82,6 @@ export async function executeOperation<
8282 } else if ( session . client !== client ) {
8383 throw new MongoInvalidArgumentError ( 'ClientSession must be from the same MongoClient' ) ;
8484 }
85- if ( session . explicit && session ?. timeoutMS != null && operation . options . timeoutMS != null ) {
86- throw new MongoInvalidArgumentError (
87- 'Do not specify timeoutMS on operation if already specified on an explicit session'
88- ) ;
89- }
9085
9186 const readPreference = operation . readPreference ?? ReadPreference . primary ;
9287 const inTransaction = ! ! session ?. inTransaction ( ) ;
@@ -108,6 +103,7 @@ export async function executeOperation<
108103 }
109104
110105 timeoutContext ??= TimeoutContext . create ( {
106+ session,
111107 serverSelectionTimeoutMS : client . s . options . serverSelectionTimeoutMS ,
112108 waitQueueTimeoutMS : client . s . options . waitQueueTimeoutMS ,
113109 timeoutMS : operation . options . timeoutMS
0 commit comments