-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can not filter by jsonb property #62
Comments
Note: problem solved. I had to add 'object' in json schema. |
Sure, I'll add an example of setting the JSON schema with object/array properties. |
This costed me a few days of frustration. :-) |
Do you think that quering an object column with a JS object isn't trivial? I did add example on setting the JSON schema properly, but then again, JSON schema has docs of it's own on how to set types and restrictions properly. There is also a link to Objection.js docs Models section that explains that and refers to the JSON schema docs. |
It is trivial after knowing what to do. I'm aware of the docs for Json, it was just not clear from specs that I have to declare it in order to be able to query. I switched from knex to Objection particularly for this and my previous code was working just fine. Thanks for the update. |
Thanks for the feedback. I'll add a note on that later. |
Please post that example. Maybe because I run an the error is: query is:
|
Not sure. I can check that in few days. Currently on vacation. |
v4.4.1 contains a fix for this issue. the fix restores the use of Docs now mentioned that JSON column must be defined in the model class and a query by string example was added to the JSON Column section. |
DB: postgresql, version: latest (just upgraded).
Working SQL:
select * from products where segmentation ->> 'type' = 'WT';
feathers code:
not working with error:
'select count(distinct("products"."id")) as "total" from ' + '"products" where "segmentation" = $1 - invalid input syntax for ' + 'type json',
Other syntax like
{type: '"WT"'}
return 0 results. Do I do something wrong or there is an issue here?The text was updated successfully, but these errors were encountered: