Skip to content
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

Nested Objects Filtering -- Null values / rows #6368

Open
adventurini opened this issue Dec 18, 2020 · 0 comments
Open

Nested Objects Filtering -- Null values / rows #6368

adventurini opened this issue Dec 18, 2020 · 0 comments

Comments

@adventurini
Copy link

When trying to build a filter, the obvious use case is to build up a dictionary of values that trigger filtering through Hasura. And all is fine and dandy. That is, until you try to utilize the _in or _nin filters. These filters are for array filtering. This is a very common type of filtering for finding matches in an array of values (think tagging).

These filters are quite buggy. They really do not work without serious customization, which is a problem on data heavy projects.

Let's say I have a table with thousands of products. However, only 20-30 of them have a certain type of specialty tags. After building the filter array in a variable ($someFilterArray) and querying against the tags, everything works fine. That is, unless the query does not require any filters. This would require setting $someFilterArray to null. Every other filter works just fine in the sense. Except for nested querying with _in and _nin. When querying these nested objects with the array filters, only rows with values will return, even when null is passed.

There are workarounds with using an empty object to check if the rows exist and building up a boolean expression. Solution found here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants