diff --git a/test/types/expressions.test.ts b/test/types/expressions.test.ts index be57ddaf38e..c74cfb84446 100644 --- a/test/types/expressions.test.ts +++ b/test/types/expressions.test.ts @@ -217,3 +217,7 @@ const switchExpr: Expression.Switch = { ] }; })(); + +(function gh12149() { + const count: Expression.Count = { $count: '$value' }; +})(); diff --git a/types/expressions.d.ts b/types/expressions.d.ts index bce492cfe5d..0a721436786 100644 --- a/types/expressions.d.ts +++ b/types/expressions.d.ts @@ -1977,7 +1977,7 @@ declare module 'mongoose' { * @version 5.0 * @see https://docs.mongodb.com/manual/reference/operator/aggregation/count/#mongodb-expression-exp.-count */ - $count: Record; + $count: Record | Path; } export interface CovariancePop {