Query related documents via GraphQL

default discord avatar
wiesson
2 months ago

The use case is that I fetch posts (or any other collection data) and I'd like to display 2-3 three other related documents. To avoid an "n+1" fetch, I'd like to retrieve the related posts in the same request as the post itself.



It was obviously very simple. I just added another graphql query with a not_equals …



/answered

    Open the post
    Continue the discussion in Discord
    Like what we're doing?
    Star us on GitHub!

    Star

    Connect with the Payload Community on Discord

    Discord

    online

    Can't find what you're looking for?

    Get help straight from the Payload team with an Enterprise License.