Connections
Connections
Connections fields allow you to paginate through one-to-many or many-to-many relation, as well as access any intermediate data. All connections have 3 root fields pageInfo
, edges
, and nodes
.
We'll be using the media (anime) character relation in these examples.
Edges
An anime can have many characters, and those characters have a specific role in the anime (Main, Support, or Background), the character can also have multiple voice actors for the particular anime. The role and voice actors do no belong to the character or the anime themselves, they belong to the connection between the two, and thus live on the edges
field, example:
Nodes
To access the characters themselves use the node
field on the edges
field:
If you don't need any of the intermediate data via the edge you can call the nodes data directly via the nodes
(plural) field on the connection:
Page Info
The pageInfo
field on the connection is the same as a pageInfo
field on the root Page query. All connections also have the pagination arguments available such as perPage
and page
.
Last updated