Skip to content

Commit 79da40a

Browse files
committed
chore: comments
1 parent 731630f commit 79da40a

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

src/operations/search_indexes/create.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { BSONType, type Document, parseUtf8ValidationOption } from '../../bson';
1+
import { type Document } from '../../bson';
22
import { type Connection } from '../../cmap/connection';
33
import { MongoDBResponse } from '../../cmap/wire_protocol/responses';
44
import type { Collection } from '../../collection';
@@ -21,15 +21,9 @@ export interface SearchIndexDescription extends Document {
2121
type?: string;
2222
}
2323

24-
class CreateSearchIndexesResponse extends MongoDBResponse {
25-
get indexesCreated() {
26-
return this.get('indexesCreated', BSONType.array);
27-
}
28-
}
29-
3024
/** @internal */
3125
export class CreateSearchIndexesOperation extends ModernizedOperation<string[]> {
32-
override SERVER_COMMAND_RESPONSE_TYPE = CreateSearchIndexesResponse;
26+
override SERVER_COMMAND_RESPONSE_TYPE = MongoDBResponse;
3327
private readonly collection: Collection;
3428
private readonly descriptions: ReadonlyArray<SearchIndexDescription>;
3529

@@ -53,11 +47,7 @@ export class CreateSearchIndexesOperation extends ModernizedOperation<string[]>
5347
}
5448

5549
override handleOk(response: InstanceType<typeof this.SERVER_COMMAND_RESPONSE_TYPE>): string[] {
56-
const indexesCreated = response.indexesCreated?.toObject({
57-
...this.bsonOptions,
58-
validation: parseUtf8ValidationOption(this.bsonOptions)
59-
});
60-
return indexesCreated ? Object.entries(indexesCreated).map(([_key, val]) => val.name) : [];
50+
return response.toObject(this.bsonOptions).indexesCreated.map((val: { name: any }) => val.name);
6151
}
6252

6353
override buildOptions(timeoutContext: TimeoutContext): ServerCommandOptions {

0 commit comments

Comments
 (0)