Skip to content

Commit

Permalink
types: add missing $median pipeline stage to aggregation types
Browse files Browse the repository at this point in the history
Fix #15209
  • Loading branch information
vkarpov15 committed Feb 4, 2025
1 parent 6107403 commit 3d67419
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/types/PipelineStage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -575,3 +575,12 @@ const vectorSearchStages: PipelineStage[] = [
}
}
];

function median() {
const medianStage: PipelineStage = {
$median: {
input: ['$test01', '$test02', '$test03'],
method: 'approximate'
}
};
}
9 changes: 9 additions & 0 deletions types/pipelinestage.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ declare module 'mongoose' {
| PipelineStage.ListSessions
| PipelineStage.Lookup
| PipelineStage.Match
| PipelineStage.Median
| PipelineStage.Merge
| PipelineStage.Out
| PipelineStage.PlanCacheStats
Expand Down Expand Up @@ -187,6 +188,14 @@ declare module 'mongoose' {
$match: FilterQuery<any>;
}

export interface Median {
/** [`$median` reference](https://www.mongodb.com/docs/v7.0/reference/operator/aggregation/median/) */
$median: {
input: number | Expression,
method: 'approximate'
}
}

export interface Merge {
/** [`$merge` reference](https://www.mongodb.com/docs/manual/reference/operator/aggregation/merge/) */
$merge: {
Expand Down

0 comments on commit 3d67419

Please sign in to comment.