From 55fde0e706beaefde2bcb448250ebf4bb11b0bd1 Mon Sep 17 00:00:00 2001 From: Mike Noseworthy Date: Sun, 24 Mar 2024 22:43:05 -0230 Subject: [PATCH] types(schema): re-export the defintion for `SearchIndexDescription` Make a `mongoose` copy of `SearchIndexDescription` from `mongodb` and re-export it for use in `typegoose`. --- types/index.d.ts | 2 +- types/indexes.d.ts | 2 ++ types/models.d.ts | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) 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;