payload
payload copied to clipboard
feat: adds relationship-based filtering to GraphQL
Description
This PR adds the ability to filter documents in GraphQL on nested relationship fields. For example, if one has collection A
with field r
being a relationship to collection B
with a text field t
, it is now possible to do a { r__t: { equals: … } }
where condition. Before, this wasn't possible.
Related: #761 #957 https://discord.com/channels/967097582721572934/1146829720885919744/1146829720885919744
This is my first contribution to Payload, so let me know what edge cases I might have missed or any code-related changes you would like to see. I didn't find a good place in the documentation to add a description of this feature, but if there is a spot I missed let me know!
- [x] I have read and understand the CONTRIBUTING.md document in this repository.
Type of change
- [x] New feature (non-breaking change which adds functionality)
Checklist:
- [x] I have added tests that prove my fix is effective or that my feature works
- [x] Existing test suite passes locally with my changes
@JarrodMFlesch is there any chance this get accepted soon?
This would be an awesome addition. It's the only thing that blocks us from using graphql and payloadcms
Bump - sorely needed!
Also bumping. Really useful feature!
Tried the commit, but it seems to cause infinite recursive loops on a project using @payloadcms/plugin-nested-docs.
Bumping! We really need this.
I'm not really sure how I missed this. I agree this feature would be killer.
I'll try to give this a look next week! Feel free to ping me if I don't!
Bumping!
@JarrodMFlesch Any progress on this one? I know the team is busy with v3 but just wanted to check, thanks!
This still seems like a useful feature. However, it would need to be reworked for 3.0.
Still hoping @JarrodMFlesch will find time to re-implement this :D
following
Bumping!
https://discord.com/channels/967097582721572934/1270037625172004876