-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
Description
Describe the Bug
The GraphQL API select flag introduced in PR #13711, returns relationship fields as empty arrays.
Relationship fields are correctly returned with select: false, but not with select: true:
select: true result |
select: false result |
|---|---|
![]() |
![]() |
authors and relatedDocuments are returned as [] |
authors and relatedDocuments are correctly returned |
The issue occurs for both polymorphic and non-polymorphic relationship fields. Join fields seem to work, though.
Link to the code that reproduces this issue
https://github.com/jhb-dev/payload-gql-select-reproduction
Reproduction Steps
- run the reproduction app
- create a new user and set
- create a new blogpost (add an author and related document)
- update the users favorite blogpost field to point to the blogpost
- open the GraphQL Playground at
/api/graphql-playground - paste the query you can find below and toggle the select field to see the difference
GraphQL query for the GraphQL Playground
query BlogPostBySlug($title: String!) {
Blogposts(where: { title: { equals: $title } }, select: true) {
docs {
id
title
subTitle
authors {
id
email
}
relatedDocuments {
relationTo
value {
... on User {
id
email
}
... on Media {
id
}
}
}
likedBy {
docs {
id
email
}
}
}
}
}Query Variables:
{
"title": "test"
}Which area(s) are affected? (Select all that apply)
area: core
Environment Info
Binaries:
Node: 24.3.0
npm: 11.4.2
Yarn: N/A
pnpm: 10.12.4
Relevant Packages:
payload: 3.62.1
next: 15.4.4
@payloadcms/db-mongodb: 3.62.1
@payloadcms/email-nodemailer: 3.62.1
@payloadcms/graphql: 3.62.1
@payloadcms/next/utilities: 3.62.1
@payloadcms/payload-cloud: 3.62.1
@payloadcms/richtext-lexical: 3.62.1
@payloadcms/translations: 3.62.1
@payloadcms/ui/shared: 3.62.1
react: 19.1.0
react-dom: 19.1.0
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:40 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6041
Available memory (MB): 24576
Available CPU cores: 14

