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' ;
2
2
import { type Connection } from '../../cmap/connection' ;
3
3
import { MongoDBResponse } from '../../cmap/wire_protocol/responses' ;
4
4
import type { Collection } from '../../collection' ;
@@ -21,15 +21,9 @@ export interface SearchIndexDescription extends Document {
21
21
type ?: string ;
22
22
}
23
23
24
- class CreateSearchIndexesResponse extends MongoDBResponse {
25
- get indexesCreated ( ) {
26
- return this . get ( 'indexesCreated' , BSONType . array ) ;
27
- }
28
- }
29
-
30
24
/** @internal */
31
25
export class CreateSearchIndexesOperation extends ModernizedOperation < string [ ] > {
32
- override SERVER_COMMAND_RESPONSE_TYPE = CreateSearchIndexesResponse ;
26
+ override SERVER_COMMAND_RESPONSE_TYPE = MongoDBResponse ;
33
27
private readonly collection : Collection ;
34
28
private readonly descriptions : ReadonlyArray < SearchIndexDescription > ;
35
29
@@ -53,11 +47,7 @@ export class CreateSearchIndexesOperation extends ModernizedOperation<string[]>
53
47
}
54
48
55
49
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 ) ;
61
51
}
62
52
63
53
override buildOptions ( timeoutContext : TimeoutContext ) : ServerCommandOptions {
You can’t perform that action at this time.
0 commit comments