@@ -27,18 +27,15 @@ import type { ClientSession } from '../sessions';
2727import { TimeoutContext } from '../timeout' ;
2828import { abortable , supportsRetryableWrites } from '../utils' ;
2929import { AggregateOperation } from './aggregate' ;
30- import { AbstractOperation , Aspect , ModernizedOperation } from './operation' ;
30+ import { AbstractOperation , Aspect } from './operation' ;
3131
3232const MMAPv1_RETRY_WRITES_ERROR_CODE = MONGODB_ERROR_CODES . IllegalOperation ;
3333const MMAPv1_RETRY_WRITES_ERROR_MESSAGE =
3434 'This MongoDB deployment does not support retryable writes. Please add retryWrites=false to your connection string.' ;
3535
36- type ResultTypeFromOperation < TOperation > =
37- TOperation extends ModernizedOperation < infer _ >
38- ? ReturnType < TOperation [ 'handleOk' ] >
39- : TOperation extends AbstractOperation < infer K >
40- ? K
41- : never ;
36+ type ResultTypeFromOperation < TOperation extends AbstractOperation > = ReturnType <
37+ TOperation [ 'handleOk' ]
38+ > ;
4239
4340/**
4441 * Executes the given operation with provided arguments.
@@ -235,8 +232,6 @@ async function tryOperation<T extends AbstractOperation, TResult = ResultTypeFro
235232 let previousOperationError : MongoError | undefined ;
236233 let previousServer : ServerDescription | undefined ;
237234
238- const isModernOperation = operation instanceof ModernizedOperation ;
239-
240235 for ( let tries = 0 ; tries < maxTries ; tries ++ ) {
241236 if ( previousOperationError ) {
242237 if ( hasWriteAspect && previousOperationError . code === MMAPv1_RETRY_WRITES_ERROR_CODE ) {
@@ -290,10 +285,6 @@ async function tryOperation<T extends AbstractOperation, TResult = ResultTypeFro
290285 operation . resetBatch ( ) ;
291286 }
292287
293- if ( ! isModernOperation ) {
294- return await operation . execute ( server , session , timeoutContext ) ;
295- }
296-
297288 try {
298289 const result = await server . modernCommand ( operation , timeoutContext ) ;
299290 return operation . handleOk ( result ) ;
0 commit comments