From 771956989e652b9ffbbaf5b223980694078b66f5 Mon Sep 17 00:00:00 2001 From: Valeri Karpov Date: Tue, 2 Aug 2022 12:22:09 -0400 Subject: [PATCH] fix(types): allow using path with $count Fix #12149 --- test/types/expressions.test.ts | 4 ++++ types/expressions.d.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) 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 {