Skip to content
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

Type error agregate $cond #12028

Closed
2 tasks done
giavy0209 opened this issue Jul 1, 2022 · 0 comments
Closed
2 tasks done

Type error agregate $cond #12028

giavy0209 opened this issue Jul 1, 2022 · 0 comments
Labels
typescript Types or Types-test related issue / Pull Request
Milestone

Comments

@giavy0209
Copy link

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Mongoose version

6.4.1

Node.js version

any

MongoDB server version

any

Description

When I use $cond

 $cond: {
    if: {
      $in //throw type error here
    },
    then: POST_TYPE_DEFAULT.EVENT_TYPE.BIRTHDAY,
    else: POST_TYPE_DEFAULT.EVENT_TYPE.ANNIVERSARY
  }

I have read expression.d.ts, it's missing type ArrayExpressionOperatorReturningBoolean in type BooleanExpression

Steps to Reproduce

use Aggregate

model.aggregate([
  {
    $addFields : {
      $cond : {
         if : {$in : []} //throw type error here
       }
    }
  }
])

Expected Behavior

Can use $in in $cond.if

@vkarpov15 vkarpov15 added this to the 6.4.3 milestone Jul 5, 2022
@vkarpov15 vkarpov15 added the typescript Types or Types-test related issue / Pull Request label Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
typescript Types or Types-test related issue / Pull Request
Projects
None yet
Development

No branches or pull requests

2 participants