Skip to content

Commit d5060c2

Browse files
indexes
1 parent 58485c9 commit d5060c2

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

src/operations/indexes.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { Document } from '../bson';
2+
import { type Connection } from '../cmap/connection';
23
import { CursorResponse } from '../cmap/wire_protocol/responses';
34
import type { Collection } from '../collection';
45
import { 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';
1719
import { 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

Comments
 (0)