@@ -1003,6 +1003,16 @@ export class Collection<TSchema extends Document = Document> {
1003
1003
) ;
1004
1004
}
1005
1005
1006
+ /**
1007
+ * @internal
1008
+ *
1009
+ * Returns all search indexes for the current collection.
1010
+ *
1011
+ * @param indexName - Optional. If specified, only indexes with matching index names will be returned.
1012
+ * @param options - The options for the list indexes operation.
1013
+ *
1014
+ * @remarks Only available when used against a 7.0+ Atlas cluster.
1015
+ */
1006
1016
listSearchIndexes ( options ?: ListSearchIndexesOptions ) : ListSearchIndexesCursor ;
1007
1017
listSearchIndexes ( indexName : string , options ?: ListSearchIndexesOptions ) : ListSearchIndexesCursor ;
1008
1018
listSearchIndexes (
@@ -1021,21 +1031,61 @@ export class Collection<TSchema extends Document = Document> {
1021
1031
return ListSearchIndexesCursor . create ( this , indexName , options ) ;
1022
1032
}
1023
1033
1034
+ /**
1035
+ * @internal
1036
+ *
1037
+ * Creates a single search index for the collection.
1038
+ *
1039
+ * @param description - The index description for the new search index.
1040
+ * @returns A promise that resolves to the name of the new search index.
1041
+ *
1042
+ * @remarks Only available when used against a 7.0+ Atlas cluster.
1043
+ */
1024
1044
async createSearchIndex ( description : SearchIndexDescription ) : Promise < string > {
1025
1045
const indexes = await this . createSearchIndexes ( [ description ] ) ;
1026
1046
return indexes [ 0 ] ;
1027
1047
}
1028
1048
1049
+ /**
1050
+ * @internal
1051
+ *
1052
+ * Creates multiple search indexes for the current collection.
1053
+ *
1054
+ * @param descriptions - An array of `SearchIndexDescription`s for the new search indexes.
1055
+ * @returns A promise that resolves to an array of the newly created search index names.
1056
+ *
1057
+ * @remarks Only available when used against a 7.0+ Atlas cluster.
1058
+ * @returns
1059
+ */
1029
1060
async createSearchIndexes (
1030
1061
descriptions : ReadonlyArray < SearchIndexDescription >
1031
1062
) : Promise < string [ ] > {
1032
1063
return executeOperation ( this . client , new CreateSearchIndexesOperation ( this , descriptions ) ) ;
1033
1064
}
1034
1065
1066
+ /**
1067
+ * @internal
1068
+ *
1069
+ * Deletes a search index by index name.
1070
+ *
1071
+ * @param name - The name of the search index to be deleted.
1072
+ *
1073
+ * @remarks Only available when used against a 7.0+ Atlas cluster.
1074
+ */
1035
1075
async dropSearchIndex ( name : string ) : Promise < void > {
1036
1076
return executeOperation ( this . client , new DropSearchIndexOperation ( this , name ) ) ;
1037
1077
}
1038
1078
1079
+ /**
1080
+ * @internal
1081
+ *
1082
+ * Updates a search index by replacing the existing index definition with the provided definition.
1083
+ *
1084
+ * @param name - The name of the search index to update.
1085
+ * @param definition - The new search index definition.
1086
+ *
1087
+ * @remarks Only available when used against a 7.0+ Atlas cluster.
1088
+ */
1039
1089
async updateSearchIndex ( name : string , definition : Document ) : Promise < void > {
1040
1090
return executeOperation ( this . client , new UpdateSearchIndexOperation ( this , name , definition ) ) ;
1041
1091
}
0 commit comments