You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was having trouble filtering results by multiple relationship values. I opened a ticket on objection.js asking how to do it. While I wait on that I figured I'd try filtering using a jsonb column instead.
My postgresql table has a jsonb column with a array of strings. I'd like to filter results by checking if the array contains a string.
It works in Objection. Here's what the query looks like.
In Feathers-Objection, I added ? to the OPERATORS_MAP list.
const OPERATORS_MAP = {
...
"?": '?'
}
The castText() part in objectify() causes postgres to throw an error.
select count(distinct("articles"."id")) as "total" from "articles" where CAST("articles"."jsonb_column"#>>'{tags}' AS text) 'news' $1 - operator does not exist: text ? unknown
Removing castText() when the operator is ? seems to fix it.
I was having trouble filtering results by multiple relationship values. I opened a ticket on objection.js asking how to do it. While I wait on that I figured I'd try filtering using a jsonb column instead.
My postgresql table has a jsonb column with a array of strings. I'd like to filter results by checking if the array contains a string.
It works in Objection. Here's what the query looks like.
In Feathers-Objection, I added ? to the OPERATORS_MAP list.
The castText() part in objectify() causes postgres to throw an error.
Removing castText() when the operator is ? seems to fix it.
After those two changes, this query works as expected.
Here's a list of jsonb operators. Hopping you can add support for them. :)
Table 9.44. Additional jsonb Operators
The text was updated successfully, but these errors were encountered: