Connection
Connection
A faction has many ships in the Star Wars universe. Relay contains functionality to make manipulating one-to-many relationships easy, using a standardized way of expressing these one-to-many relationships. This standard connection model offers ways of slicing and paginating through the connection.
Let's take the rebels, and ask for their first ship:
query RebelsShipsQuery { rebels { name, ships(first: 1) { edges { node { name } } } } }
yields
{ "rebels": { "name": "Alliance to Restore the Republic", "ships": { "edges": [ { "node": { "name": "X-Wing" } } ] } } }
That used the first
argument to ships
to slice the result set down to t