Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions types/models.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ declare module 'mongoose' {
SessionStarter {
new <DocType = Partial<TRawDocType>>(doc?: DocType, fields?: any | null, options?: AnyObject): THydratedDocumentType;

aggregate<R = any>(pipeline?: PipelineStage[], options?: AggregateOptions): Aggregate<Array<R>>;
aggregate<R = any>(pipeline: PipelineStage[]): Aggregate<Array<R>>;
aggregate<R = any>(pipeline?: PipelineStage<TRawDocType>[], options?: AggregateOptions): Aggregate<Array<R>>;
aggregate<R = any>(pipeline: PipelineStage<TRawDocType>[]): Aggregate<Array<R>>;

/** Base Mongoose instance the model uses. */
base: Mongoose;
Expand Down
10 changes: 5 additions & 5 deletions types/pipelinestage.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<TSchema = any> =
| PipelineStage.AddFields
| PipelineStage.Bucket
| PipelineStage.BucketAuto
Expand All @@ -19,7 +19,7 @@ declare module 'mongoose' {
| PipelineStage.Limit
| PipelineStage.ListSessions
| PipelineStage.Lookup
| PipelineStage.Match
| PipelineStage.Match<TSchema>
| PipelineStage.Merge
| PipelineStage.Out
| PipelineStage.PlanCacheStats
Expand Down Expand Up @@ -114,7 +114,7 @@ declare module 'mongoose' {
$facet: Record<string, FacetPipelineStage[]>;
}

export type FacetPipelineStage = Exclude<PipelineStage, PipelineStage.CollStats | PipelineStage.Facet | PipelineStage.GeoNear | PipelineStage.IndexStats | PipelineStage.Out | PipelineStage.Merge | PipelineStage.PlanCacheStats>;
export type FacetPipelineStage<TSchema=any> = Exclude<PipelineStage<TSchema>, 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/) */
Expand Down Expand Up @@ -182,9 +182,9 @@ declare module 'mongoose' {
}
}

export interface Match {
export interface Match<TSchema = any> {
/** [`$match` reference](https://www.mongodb.com/docs/manual/reference/operator/aggregation/match/) */
$match: QueryFilter<any>;
$match: QueryFilter<TSchema>;
}

export interface Merge {
Expand Down
Loading