0

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?

Joe Moore
  • 43
  • 3

1 Answers1

0

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.

Valentin Roudge
  • 555
  • 4
  • 14
  • 1
    It has partial jsonb support, but this is a grey area. And our usage isn't compatible with `findDoc`. – Joe Moore Nov 08 '16 at 23:36