Skip to content

Commit 606f19a

Browse files
authored
Improve GraphQL queries explanations (Flat vs. Relay-style) (#2621)
* docs: expand v5 migration info * Use caution callout instead of note * Remove unwanted added note about upgrading * Add blank line * Add blank line * Ensure code blocks are properly indented in instructions * Add link to documentId breaking change
1 parent 9d54a1a commit 606f19a

File tree

3 files changed

+172
-161
lines changed

3 files changed

+172
-161
lines changed

docusaurus/docs/cms/api/graphql.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ The GraphQL plugin exposes only one endpoint that handles all queries and mutati
7272
The GraphQL API does not support media upload. Use the [REST API `POST /upload` endpoint](/cms/api/rest/upload) for all file uploads and use the returned info to link to it in content types. You can still update or delete uploaded files with the `updateUploadFile` and `deleteUploadFile` mutations using media files `id` (see [mutations on media files](#mutations-on-media-files)).
7373
:::
7474
75+
:::caution `documentId` only
76+
The GraphQL API exposes documents using only the `documentId` field. The previous numeric `id` is no longer available here, although it is still returned by the REST API for backward compatibility (see [breaking change](/cms/migration/v4-to-v5/breaking-changes/use-document-id) for details).
77+
:::
78+
79+
7580
## Queries
7681
7782
Queries in GraphQL are used to fetch data without modifying it.
@@ -114,6 +119,9 @@ Documents <DocumentDefinition/> can be fetched by their `documentId`.
114119
115120
To fetch multiple documents <DocumentDefinition/> you can use simple, flat queries or <ExternalLink to="https://www.apollographql.com/docs/technotes/TN0029-relay-style-connections/" text="Relay-style"/> queries:
116121
122+
Flat queries return only the requested fields for each document. Relay-style queries end with `_connection` and return a `nodes` array together with a `pageInfo` object. Use Relay-style queries when you need pagination metadata.
123+
124+
117125
<Tabs groupId="flat-relay">
118126
119127
<TabItem value="flat" label="Flat queries">

0 commit comments

Comments
 (0)