I'm struggling to convert this to an ORM filter query:
select count(*) from issues WHERE pending_notifications ? 'flooby';
pending_notifications is a JSONB field containing a simple JSON array.
I'm not sure how to structure the filter using the question mark operator
I believe a Postgres ARRAY would work like this:
query.filter(pending_notifications.any('flooby'))
But I'm using JSONB and the filter syntax is not the same.
Any suggestions
You can use the .op()
method to use any verbatim operator:
query.filter(pending_notifications.op("?")("flooby"))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With