File tree Expand file tree Collapse file tree 1 file changed +3
-13
lines changed
src/operations/search_indexes Expand file tree Collapse file tree 1 file changed +3
-13
lines changed Original file line number Diff line number Diff line change 1- import { BSONType , type Document , parseUtf8ValidationOption } from '../../bson' ;
1+ import { type Document } from '../../bson' ;
22import { type Connection } from '../../cmap/connection' ;
33import { MongoDBResponse } from '../../cmap/wire_protocol/responses' ;
44import 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 */
3125export 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 {
You can’t perform that action at this time.
0 commit comments