I'm trying to construct a query on an array using massivejs, but it keeps telling me the operator is unsupported.
This query works:
SELECT * FROM my_table WHERE data->'items' @> '[{"foo": "bar"}]';
where data
is a jsonb field and items
is an array of objects. My massivejs query is:
{ 'data #>> {items} @>': '[{ \"foo\": \"bar\" }]' }
but massive tells me the @>
operator doesn't exist.
I realize I can execute raw SQL, but I'm building up a query with paging, sorting, and other query conditions, so I'd rather not rebuild all that if I can avoid it.
Is there a mistake in my query? Is this something massivejs even supports?
I don't think massivejs
supports jsonb operators.
Your query is SQL-correct. And I guess that you'll have to do raw SQL on this one.
I just read the API docs and it goes in my direction but I might be overlooking something .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.