Skip to content

Commit

Permalink
DRIVERS-2768: Restore missing "type" option docs for search indexes (#…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
jmikola authored Sep 5, 2024
1 parent 25b0b44 commit 39db05c
Showing 1 changed file with 31 additions and 7 deletions.
38 changes: 31 additions & 7 deletions source/index-management/index-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -902,19 +902,39 @@ await collection.dropSearchIndex('my-test-index');

```typescript
interface SearchIndexModel {
// The definition for this index.
/**
* Document describing the index to create.
*
* The definition syntax depends on whether you create a standard search index
* or a vector search index.
*
* @see https://www.mongodb.com/docs/manual/reference/command/createSearchIndexes/
*/
definition: Document;

// The name for this index, if present.
name: Optional<string>;

// The type for this index, if present. Can be either "search" or "vectorSearch".
type: Optional<string>;
/**
* Contains the options for the index.
*/
options: SearchIndexOptions;
}

interface SearchIndexOptions {
// The name for this index, if present.
/**
* Name of the search index to create.
*
* The server will use "default" if this option is not specified.
*/
name: Optional<string>;

/**
* Type of search index to create. Defaults to "search" if not provided.
*
* Specify "search" for a standard search index or "vectorSearch" for a vector
* search index.
*
* The server will use "search" if this option is not specified.
*/
type: Optional<string>;
}

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

#### Changelog

- 2024-09-05: Moved options in SearchIndexModel to SearchIndexOptions for consistency with IndexModel and IndexOptions.

- 2024-03-06: Added `type` option to SearchIndexOptions.

- 2024-03-05: Migrated from reStructuredText to Markdown.

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

0 comments on commit 39db05c

Please sign in to comment.