Wrong type to $in expr
See original GitHub issuePrerequisites
- I have written a descriptive issue title
Mongoose version
6.4.0
Node.js version
16.14.2
MongoDB version
cosmosDB 4 - not really relevant
Operating system
Windows
Operating system version (i.e. 20.04, 11.3, 10)
WSL 2 - Ubuntu 20.04
Issue
I have received this issue
Type 'string[]' is not assignable to type '[Expression, ArrayExpression<any>]'. Target requires 2 element(s) but source may have fewer.
for this snippet:
{
$match: {
'data.sourceCurrency': { $in: ['USD', 'GBP', 'EUR'] },
},
}
I’m not sure what more data to provide, but unless I’ve mistaken it looks like the $in an array is an array of 2 items which [Expression, ArrayExpression<any>]
instead of Expression[] | ArrayExpression<any>[]
P.S: ArrayExpression
covers T[]
which includes string[]
which is my type
Issue Analytics
- State:
- Created a year ago
- Comments:5
Top Results From Across the Web
PLS-00382: expression is of wrong type - Burleson Consulting
Question: What causes the PLS-00382 error? ... Cause: An expression has the wrong datatype for the context in which it was found. Action:...
Read more >expression is of wrong type for function - Stack Overflow
In the function declaration, you said. RETURN EMP.ENAME%TYPE. I assume the data type of column ENAME in table EMP is some sort of...
Read more >PLS-00382: expression is of wrong type - Ask TOM
PLS-00382: expression is of wrong type I get PLS-00382: expression is of wrong type in the following scenario:vemail VARCHAR2(80) DEFAULT NULL;for i in...
Read more >Common Error Messages · OCaml Tutorials
"This expression has type X but is here used with type Y" means that if the contents of the expression is isolated (2.5),...
Read more >scm-error-messages.txt - Department of Computer Science
ERROR : Wrong type to apply: (see errobj) ERROR: unbound variable: foo ERROR: if: missing or extra expression (see errobj) The subsections below...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
im facing similiar problems with some aggregate pipelines
Where i get
Type 'null' is not assignable to type 'Expression | [Expression, Expression]'
. Removing the$ne
leaves me withType '{ $exists: true; }' is not assignable to type 'Expression'.
This is some inconsistency between the docs of mongo and real mongodb syntax. I will provide a fix tomorrow. I am currently not having access to my Laptop.