payload icon indicating copy to clipboard operation
payload copied to clipboard

feat: adds relationship-based filtering to GraphQL

Open jolle opened this issue 1 year ago • 4 comments

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

jolle avatar Sep 08 '23 09:09 jolle

@JarrodMFlesch is there any chance this get accepted soon?

XPOL555 avatar Sep 19 '23 09:09 XPOL555

This would be an awesome addition. It's the only thing that blocks us from using graphql and payloadcms

Bump - sorely needed!

tyteen4a03 avatar Dec 13 '23 22:12 tyteen4a03

Also bumping. Really useful feature!

MarkAtOmniux avatar Dec 29 '23 15:12 MarkAtOmniux

Tried the commit, but it seems to cause infinite recursive loops on a project using @payloadcms/plugin-nested-docs.

Jylth avatar Jan 01 '24 18:01 Jylth

Bumping! We really need this.

rumbleperson avatar Feb 16 '24 16:02 rumbleperson

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!

JarrodMFlesch avatar Feb 24 '24 03:02 JarrodMFlesch

Bumping!

issac-lezon avatar Mar 05 '24 23:03 issac-lezon

@JarrodMFlesch Any progress on this one? I know the team is busy with v3 but just wanted to check, thanks!

slavanossar avatar Mar 21 '24 06:03 slavanossar

This still seems like a useful feature. However, it would need to be reworked for 3.0.

denolfe avatar May 01 '24 19:05 denolfe

Still hoping @JarrodMFlesch will find time to re-implement this :D

tyteen4a03 avatar May 01 '24 19:05 tyteen4a03

following

wellitongervickas avatar Aug 05 '24 18:08 wellitongervickas

Bumping!

https://discord.com/channels/967097582721572934/1270037625172004876

faizur11786 avatar Aug 06 '24 06:08 faizur11786