New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typings: New Aggregation Type Issues [DateExpressionOperatorReturningNumber
, AddToSet
, ...]
#12017
Comments
DateExpressionOperatorReturningNumber
to NumberExpression
DateExpressionOperatorReturningNumber
, AddToSet
, ...]
I'm experiencing this as well. Another example: const d: Expression.Add = {
$add: [
'$value',
{
$cond: { // errors
if: {
$lte: ["$value", "$otherValue"],
},
then: 12,
else: 0,
},
},
],
}; |
Avg requires ArrayExpression const d: Expression.Avg = { $avg: { $subtract: [{ $ifNull: ['$end', new Date()] }, '$start'] } }; // errors |
One of the type that does not work well is $ifNull inside other expression, had issues with it :
|
Facing the same issue $ifNull problem.
|
Prerequisites
Running:
Issue
This new update has messed up a log of my aggregation typings (like others).
1. Add
DateExpressionOperatorReturningNumber
toNumberExpression
This doesn't work currently, but it should. I believe it was forgotten:
2. Some stages and operators specify "Expressions" when they can take values as well
This breaks quite a few things (
$addToSet
as well):3. AddToSet requires
ArrayExpression
According to the docs it just takes an "expression" ( https://www.mongodb.com/docs/manual/reference/operator/aggregation/addToSet/ ).
4.
Cond
doesn't allow nestedCond
s...because it is too strict on the first requirement being a
BooleanExpression
. I think switching most operators to accept aConditionalExpressionOperator
(with a<T>
or otherwise) would help a lot, becauseIfNull
is also throwing things.Otherwise, reintroducing the old Pipeline type and/or having a more flexible Pipeline type in parallel, if we wanted/needed less strict checks would be great.
The text was updated successfully, but these errors were encountered: