Skip to content

Commit b0816d8

Browse files
add doc comments and the internal tag to new collection helpers
1 parent 3531140 commit b0816d8

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

src/collection.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,6 +1003,16 @@ export class Collection<TSchema extends Document = Document> {
10031003
);
10041004
}
10051005

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+
*/
10061016
listSearchIndexes(options?: ListSearchIndexesOptions): ListSearchIndexesCursor;
10071017
listSearchIndexes(indexName: string, options?: ListSearchIndexesOptions): ListSearchIndexesCursor;
10081018
listSearchIndexes(
@@ -1021,21 +1031,61 @@ export class Collection<TSchema extends Document = Document> {
10211031
return ListSearchIndexesCursor.create(this, indexName, options);
10221032
}
10231033

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+
*/
10241044
async createSearchIndex(description: SearchIndexDescription): Promise<string> {
10251045
const indexes = await this.createSearchIndexes([description]);
10261046
return indexes[0];
10271047
}
10281048

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+
*/
10291060
async createSearchIndexes(
10301061
descriptions: ReadonlyArray<SearchIndexDescription>
10311062
): Promise<string[]> {
10321063
return executeOperation(this.client, new CreateSearchIndexesOperation(this, descriptions));
10331064
}
10341065

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+
*/
10351075
async dropSearchIndex(name: string): Promise<void> {
10361076
return executeOperation(this.client, new DropSearchIndexOperation(this, name));
10371077
}
10381078

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+
*/
10391089
async updateSearchIndex(name: string, definition: Document): Promise<void> {
10401090
return executeOperation(this.client, new UpdateSearchIndexOperation(this, name, definition));
10411091
}

0 commit comments

Comments
 (0)