1
1
import type { Document } from '../bson' ;
2
+ import { type Connection } from '../cmap/connection' ;
2
3
import { CursorResponse } from '../cmap/wire_protocol/responses' ;
3
4
import type { Collection } from '../collection' ;
4
5
import { type AbstractCursorOptions } from '../cursor/abstract_cursor' ;
@@ -12,6 +13,7 @@ import {
12
13
type CollationOptions ,
13
14
CommandOperation ,
14
15
type CommandOperationOptions ,
16
+ ModernizedCommandOperation ,
15
17
type OperationParent
16
18
} from './command' ;
17
19
import { Aspect , defineAspects } from './operation' ;
@@ -366,7 +368,8 @@ export type ListIndexesOptions = AbstractCursorOptions & {
366
368
} ;
367
369
368
370
/** @internal */
369
- export class ListIndexesOperation extends CommandOperation < CursorResponse > {
371
+ export class ListIndexesOperation extends ModernizedCommandOperation < CursorResponse > {
372
+ override SERVER_COMMAND_RESPONSE_TYPE = CursorResponse ;
370
373
/**
371
374
* @remarks WriteConcern can still be present on the options because
372
375
* we inherit options from the client/db/collection. The
@@ -389,12 +392,8 @@ export class ListIndexesOperation extends CommandOperation<CursorResponse> {
389
392
return 'listIndexes' as const ;
390
393
}
391
394
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 ) ;
398
397
399
398
const cursor = this . options . batchSize ? { batchSize : this . options . batchSize } : { } ;
400
399
@@ -406,7 +405,13 @@ export class ListIndexesOperation extends CommandOperation<CursorResponse> {
406
405
command . comment = this . options . comment ;
407
406
}
408
407
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 ;
410
415
}
411
416
}
412
417
0 commit comments