Skip to content

Commit 39db05c

Browse files
authored
DRIVERS-2768: Restore missing "type" option docs for search indexes (#1650)
b746fcc incorrectly added the "type" option to IndexOptions instead of SearchIndexOptions. Moreover, that change was made to the RST file after it was converted to Markdown and shortly before it was replaced with a stub pointing to the Markdown file. As a result, the change was entirely lost. This adds back documentation for the "type" option and also restructures the SearchIndexModel and SearchIndexOptions definitions to be more consistent with IndexModel and IndexOptions. The "name" option is no longer duplicated between both interfaces.
1 parent 25b0b44 commit 39db05c

File tree

1 file changed

+31
-7
lines changed

1 file changed

+31
-7
lines changed

source/index-management/index-management.md

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -902,19 +902,39 @@ await collection.dropSearchIndex('my-test-index');
902902

903903
```typescript
904904
interface SearchIndexModel {
905-
// The definition for this index.
905+
/**
906+
* Document describing the index to create.
907+
*
908+
* The definition syntax depends on whether you create a standard search index
909+
* or a vector search index.
910+
*
911+
* @see https://www.mongodb.com/docs/manual/reference/command/createSearchIndexes/
912+
*/
906913
definition: Document;
907914

908-
// The name for this index, if present.
909-
name: Optional<string>;
910-
911-
// The type for this index, if present. Can be either "search" or "vectorSearch".
912-
type: Optional<string>;
915+
/**
916+
* Contains the options for the index.
917+
*/
918+
options: SearchIndexOptions;
913919
}
914920

915921
interface SearchIndexOptions {
916-
// The name for this index, if present.
922+
/**
923+
* Name of the search index to create.
924+
*
925+
* The server will use "default" if this option is not specified.
926+
*/
917927
name: Optional<string>;
928+
929+
/**
930+
* Type of search index to create. Defaults to "search" if not provided.
931+
*
932+
* Specify "search" for a standard search index or "vectorSearch" for a vector
933+
* search index.
934+
*
935+
* The server will use "search" if this option is not specified.
936+
*/
937+
type: Optional<string>;
918938
}
919939

920940
/**
@@ -1125,6 +1145,10 @@ from mistakenly specifying this option, drivers manually verify it is only sent
11251145

11261146
#### Changelog
11271147

1148+
- 2024-09-05: Moved options in SearchIndexModel to SearchIndexOptions for consistency with IndexModel and IndexOptions.
1149+
1150+
- 2024-03-06: Added `type` option to SearchIndexOptions.
1151+
11281152
- 2024-03-05: Migrated from reStructuredText to Markdown.
11291153

11301154
- 2023-11-08: Clarify that `readConcern` and `writeConcern` must not be applied to search index management commands.

0 commit comments

Comments
 (0)