Skip to content

Count on Join not available on GraphQL #13077

@chrisAlwinYS

Description

@chrisAlwinYS

Documentation Issue

Under the Join field docs, it states that the count option is available for Local API, GraphQL and REST API.
This works for REST API but not GraphQL. Is this an error? Would really like the functionality on GraphQL but the docs are misleading right now.

I have been trying to get to work with GraphQL with no luck, but the REST API works as intended.

https://payloadcms.com/docs/fields/join#query-options

Additional Details

Example Rest Query: https://payloadurl.example/api/categoriesSectors?joins[relatedDocuments][count]=true

GraphQL query:

  query Get_RelatedDocs ($type: JSON)  {
    CategoriesSectors {
      docs {
        id 
        title
        relatedDocuments(
          count:true
          where: { type: { equals: $type } }
        ) {
          docs {
            id
          }
        }
      }
    }
  }

results in:

  "errors": [
    {
      "message": "Unknown argument \"count\" on field \"CategoriesSector.relatedDocuments\". Did you mean \"sort\"?",
      "locations": [
        {
          "line": 27,
          "column": 11
        }
      ]
    }
  ]
}```

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions