diff --git a/types/models.d.ts b/types/models.d.ts index 627666c24e..e4e161623d 100644 --- a/types/models.d.ts +++ b/types/models.d.ts @@ -303,8 +303,8 @@ declare module 'mongoose' { SessionStarter { new >(doc?: DocType, fields?: any | null, options?: AnyObject): THydratedDocumentType; - aggregate(pipeline?: PipelineStage[], options?: AggregateOptions): Aggregate>; - aggregate(pipeline: PipelineStage[]): Aggregate>; + aggregate(pipeline?: PipelineStage[], options?: AggregateOptions): Aggregate>; + aggregate(pipeline: PipelineStage[]): Aggregate>; /** Base Mongoose instance the model uses. */ base: Mongoose; diff --git a/types/pipelinestage.d.ts b/types/pipelinestage.d.ts index 1f549594df..6d08fae2d3 100644 --- a/types/pipelinestage.d.ts +++ b/types/pipelinestage.d.ts @@ -2,7 +2,7 @@ declare module 'mongoose' { /** * [Stages reference](https://www.mongodb.com/docs/manual/reference/operator/aggregation-pipeline/#aggregation-pipeline-stages) */ - export type PipelineStage = + export type PipelineStage = | PipelineStage.AddFields | PipelineStage.Bucket | PipelineStage.BucketAuto @@ -19,7 +19,7 @@ declare module 'mongoose' { | PipelineStage.Limit | PipelineStage.ListSessions | PipelineStage.Lookup - | PipelineStage.Match + | PipelineStage.Match | PipelineStage.Merge | PipelineStage.Out | PipelineStage.PlanCacheStats @@ -114,7 +114,7 @@ declare module 'mongoose' { $facet: Record; } - export type FacetPipelineStage = Exclude; + export type FacetPipelineStage = Exclude, PipelineStage.CollStats | PipelineStage.Facet | PipelineStage.GeoNear | PipelineStage.IndexStats | PipelineStage.Out | PipelineStage.Merge | PipelineStage.PlanCacheStats>; export interface GeoNear { /** [`$geoNear` reference](https://www.mongodb.com/docs/manual/reference/operator/aggregation/geoNear/) */ @@ -182,9 +182,9 @@ declare module 'mongoose' { } } - export interface Match { + export interface Match { /** [`$match` reference](https://www.mongodb.com/docs/manual/reference/operator/aggregation/match/) */ - $match: QueryFilter; + $match: QueryFilter; } export interface Merge {