diff --git a/types/index.d.ts b/types/index.d.ts index b3baf6c8a3e..dc969e483f3 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -279,7 +279,7 @@ declare module 'mongoose' { * * @remarks Search indexes are only supported when used against a 7.0+ Mongo Atlas cluster. */ - searchIndex(description: mongodb.SearchIndexDescription): this; + searchIndex(description: SearchIndexDescription): this; /** * Returns a list of indexes that this schema declares, via `schema.index()` diff --git a/types/indexes.d.ts b/types/indexes.d.ts index 3c5172352aa..f0891f081eb 100644 --- a/types/indexes.d.ts +++ b/types/indexes.d.ts @@ -86,4 +86,6 @@ declare module 'mongoose' { expires?: number | string; weights?: Record; } + + type SearchIndexDescription = mongodb.SearchIndexDescription; } diff --git a/types/models.d.ts b/types/models.d.ts index 7291e5ca79f..a56f1ee92e4 100644 --- a/types/models.d.ts +++ b/types/models.d.ts @@ -327,7 +327,7 @@ declare module 'mongoose' { * Create an [Atlas search index](https://www.mongodb.com/docs/atlas/atlas-search/create-index/). * This function only works when connected to MongoDB Atlas. */ - createSearchIndex(description: mongodb.SearchIndexDescription): Promise; + createSearchIndex(description: SearchIndexDescription): Promise; /** Connection the model uses. */ db: Connection;