Skip to content

Commit

Permalink
Merge pull request #13792 from mreouven/patch-1
Browse files Browse the repository at this point in the history
Enhance Mongoose Typings with SearchMeta Interface for Atlas Search
  • Loading branch information
vkarpov15 authored Aug 28, 2023
2 parents e36fc48 + f44e169 commit 90fc4d2
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions types/pipelinestage.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ declare module 'mongoose' {
| PipelineStage.ReplaceWith
| PipelineStage.Sample
| PipelineStage.Search
| PipelineStage.SearchMeta
| PipelineStage.Set
| PipelineStage.SetWindowFields
| PipelineStage.Skip
Expand Down Expand Up @@ -239,6 +240,20 @@ declare module 'mongoose' {
}
}

export interface SearchMeta {
/** [`$searchMeta` reference](https://www.mongodb.com/docs/atlas/atlas-search/query-syntax/#mongodb-pipeline-pipe.-searchMeta) */
$searchMeta: {
index?: string;
highlight?: {
/** [`highlightPath` reference](https://docs.atlas.mongodb.com/atlas-search/path-construction/#multiple-field-search) */
path: string | string[] | { value: string, multi: string };
maxCharsToExamine?: number;
maxNumPassages?: number;
};
[operator: string]: any;
}
}

export interface Set {
/** [`$set` reference](https://www.mongodb.com/docs/manual/reference/operator/aggregation/set/) */
$set: Record<string, AnyExpression | any>
Expand Down

0 comments on commit 90fc4d2

Please sign in to comment.