-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
_and filter doesn't work on many to any #20009
Comments
Thank you @br41nslug for the answer. You're right, so I added the two filters to the _and: That changed nothing. If I'll delete one of them: I tried the filter on the GUI only to check if it works there. My main issue is, that it doesn't work in GrapHQL. So I'll reopen this issue. |
Does it then also work the other way around? like just the "Foo 1" filter because i was not able to reproduce this in the screenshot i originally shared 🤔 |
I think the missing key here is that you'll probably want to use the relational https://docs.directus.io/reference/filter-rules.html#some-vs-none-in-one-to-many something like perhaps:
|
I saw that in the docs, but it didn't work for me (I'll use it, if it works ;). I think that's pretty near to your sample:
What I get is this:
I think there should be a way to filter for different values / collection in a M2A relationship. You can do this type of thing in SQL as well, so why not in a filter? I'm thankful for every idea 😊 |
I can't find any _some types in the GraphQl schema. So I don't think that _some works.
That query above should have an implicit "_some". It says (or I want to say): Give me every "Main" item, that references at least one Bar item with name "X" and one Foo item with name "Y". |
@br41nslug what's about this ticket? You closed it without any solution. This doesn't work - and I think it should (if you don't think so, then this should be in the docs anywhere):
If I'm wrong, please show me the solution and I'm very happy. |
The solution basically lies in #20009 (comment), although |
Describe the Bug
I have a collection, that references to other collections via many to any relationship. In my sample I've got a collection "Main", that has a m2a relation to "Foo" and "Bar".
I want to filter all "Mains", that have a Foo "Foo 2" AND that have a Bar "Bar 1". Filtering one of those works, but I'm not able to get a result if I do it with "_and". Combining them with _and results always in an empty array.
Here ist the GraphQL query:
To Reproduce
Directus Version
v10.6.3
Hosting Strategy
Self-Hosted (Docker Image)
The text was updated successfully, but these errors were encountered: