GraphQL support for nested criteria queries #761
Replies: 6 comments 6 replies
-
@lucianogreiner, thanks for all the details. We're going to implement this. We'll update here when it is ready. |
Beta Was this translation helpful? Give feedback.
-
is there any way to handle querying a relationship? Here's my use case
and I need to get all the CarouselCards that have a specific state. Hoping something like this would have worked:
|
Beta Was this translation helpful? Give feedback.
-
@XPOL555 some news? |
Beta Was this translation helpful? Give feedback.
-
It looks like there's a PR for this now #3296 Hope it can be prioritized! |
Beta Was this translation helpful? Give feedback.
-
Any updates on this feature? I was hoping it might get a mention during this morning's v3 status call. IIRC somebody in discord said it's implemented already in v3, but I can't find it anymore. So. I'm wondering...
I am interested in contributing a PR, but I don't understand why #3296 was left to die on the vine, so I'd love to get more insight into the payload team's current thinking re this issue. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Any update on this for v3? AFAICT it's still not supported. I'd understand if the team has decided not to implement this feature, especially with a viable alternative available now in the form of local API w/ field selection in v3, but some clarity would be really helpful here. At the moment this is a big missing feature that merits a warning in the docs. I imagine I'm not the only user who would've pursued a different architecture if I'd realized I could only query relationships via ID ahead of time. |
Beta Was this translation helpful? Give feedback.
-
Currently, "relationship" typed fields can only be filtered by ID on GraphQL:
Therefore, it is not possible to query Todos where the user email field is equal to something, as an example.
Such operation is supported using Rest and Local query APIs:
Ideally, we should be able to make nested queries using GraphQL, such as:
Of course that should respect both the maxDepth configuration at field and server config levels, and the GraphQL maxComplexity setting.
Additionally, we should decide how relationship fields marked with hasMany would behave for schema generation.
Using the example above, if we have multiple users attached to a Todo entry, in my opinion it is acceptable that we might be searching for Todos where all or some of attached users match a certain criteria. We see this on Keystoke as a reference.
I suggest the following in case the relationship is marked with hasMany:
If any of my Todo users match (Using "any", as possibly "in" is already being used for ID matching. Could also be "anyOf"):
If all of my Todo users match: (Could also be "allOf"):
Not to forget, we should also support the negate options of all if possible.
I would be glad to help implementing this if you think this is useful.
Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions