Skip to content

Commit 7719569

Browse files
committed
fix(types): allow using path with $count
Fix #12149
1 parent f50181e commit 7719569

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

test/types/expressions.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,3 +217,7 @@ const switchExpr: Expression.Switch = {
217217
]
218218
};
219219
})();
220+
221+
(function gh12149() {
222+
const count: Expression.Count = { $count: '$value' };
223+
})();

types/expressions.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1977,7 +1977,7 @@ declare module 'mongoose' {
19771977
* @version 5.0
19781978
* @see https://docs.mongodb.com/manual/reference/operator/aggregation/count/#mongodb-expression-exp.-count
19791979
*/
1980-
$count: Record<string | number | symbol, never>;
1980+
$count: Record<string | number | symbol, never> | Path;
19811981
}
19821982

19831983
export interface CovariancePop {

0 commit comments

Comments
 (0)