id | array |
===|== ===========|
1|{"1","2","3"}|
How to use sequelize to query to see if an array field is a value 1.
I tried:
array: {$contains: "1" }
This gave me:
array @> "1"
There is an error:
Possibly unhandled SequelizeDatabaseError: array value must start with "{" or dimension information
UPDATE
I can do:
Array: {$contains:'{‘value’}’}
Is there a more correct way?
array: {$contains: ["1"] }
That works. Cheers! !
Suppose I have a PG ARRAY field:
id | array |
== =|=============|
1|{"1","2","3"}|
How to use sequelize query to view array Is the field value 1.
I tried:
array: {$contains: "1" }
This Gave me:
array @> "1"
There is an error:
Possibly unhandled SequelizeDatabaseError: array value must start with "{" or dimension information
UPDATE
I can do:
Array: {$contains:'{‘value’}’}
Is there a more correct way?
I realized that sequelize expects conditions to be an array:
array: {$contains : ["1"] }
That works. Cheers! !