11import type { Document } from '../bson' ;
2+ import { type Connection } from '../cmap/connection' ;
23import { CursorResponse } from '../cmap/wire_protocol/responses' ;
34import type { Collection } from '../collection' ;
45import { type AbstractCursorOptions } from '../cursor/abstract_cursor' ;
@@ -12,6 +13,7 @@ import {
1213 type CollationOptions ,
1314 CommandOperation ,
1415 type CommandOperationOptions ,
16+ ModernizedCommandOperation ,
1517 type OperationParent
1618} from './command' ;
1719import { Aspect , defineAspects } from './operation' ;
@@ -366,7 +368,8 @@ export type ListIndexesOptions = AbstractCursorOptions & {
366368} ;
367369
368370/** @internal */
369- export class ListIndexesOperation extends CommandOperation < CursorResponse > {
371+ export class ListIndexesOperation extends ModernizedCommandOperation < CursorResponse > {
372+ override SERVER_COMMAND_RESPONSE_TYPE = CursorResponse ;
370373 /**
371374 * @remarks WriteConcern can still be present on the options because
372375 * we inherit options from the client/db/collection. The
@@ -389,12 +392,8 @@ export class ListIndexesOperation extends CommandOperation<CursorResponse> {
389392 return 'listIndexes' as const ;
390393 }
391394
392- override async execute (
393- server : Server ,
394- session : ClientSession | undefined ,
395- timeoutContext : TimeoutContext
396- ) : Promise < CursorResponse > {
397- const serverWireVersion = maxWireVersion ( server ) ;
395+ override buildCommandDocument ( connection : Connection ) : Document {
396+ const serverWireVersion = maxWireVersion ( connection ) ;
398397
399398 const cursor = this . options . batchSize ? { batchSize : this . options . batchSize } : { } ;
400399
@@ -406,7 +405,13 @@ export class ListIndexesOperation extends CommandOperation<CursorResponse> {
406405 command . comment = this . options . comment ;
407406 }
408407
409- return await super . executeCommand ( server , session , command , timeoutContext , CursorResponse ) ;
408+ return command ;
409+ }
410+
411+ override handleOk (
412+ response : InstanceType < typeof this . SERVER_COMMAND_RESPONSE_TYPE >
413+ ) : CursorResponse {
414+ return response ;
410415 }
411416}
412417
0 commit comments