You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and gives an error on a valid mongoDB aggregation query.
error TS2769: No overload matches this call.
Overload 1 of 2, '(pipeline?: PipelineStage[], options?: AggregateOptions, callback?: Callback<T[]>): Aggregate<T[]>', gave the following error.
Type 'string' is not assignable to type 'Record<string | number | symbol, never>'.
Overload 2 of 2, '(pipeline: PipelineStage[], callback?: Callback<T[]>): Aggregate<T[]>', gave the following error.
Type 'string' is not assignable to type 'Record<string | number | symbol, never>'.
50 count: { $count: "$value" },
@Naeoth I took a closer look and the typings as written are correct, and do support the syntax described in the MongoDB documentation. { [key: string]: AccumulatorOperator } is more correct because MongoDB doesn't support multiple accumulator expressions on one field. Multiple accumulators throw "The field 'field-name-here' must specify one accumulator"
Prerequisites
Mongoose version
6.4.6
Node.js version
16.15.0
MongoDB server version
5.0
Description
The type changed on the 6.4.0: f57e007#diff-46be1d2c4ab7acfb5007f7bcccbf3d2e9551597d0bd0d91cc0400a4faffb76cfR116-R118
and gives an error on a valid mongoDB aggregation query.
For a group the type should be as before:
Steps to Reproduce
Expected Behavior
No response
The text was updated successfully, but these errors were encountered: