Pagination
When a one-to-many relationship exists between two nodes, for example organization -> plans, we paginate the responses from the query. Forward, cursor based pagination is used, for more details see here.
Forward Pagination
The arguments for forward pagination are:
first
a non-negative integer representing the number of resultsafter
: the cursor of which the results will be after
The connection which is returned includes the following fields:
pageInfo
: which contains the fieldshasNextPage
andendCursor
edges
: which includes a list of edges. Each edge contains the cursor for that node and the node itself
Example:
For this example we will go through the organization link to plans.
Firstly we'll get the plans connection with the first two edges:
This returns:
You can see that hasNextPage
is true
so we know there are more items and the endCursor
is set to the last item in the response. Two fetch the next page you simply update the query to include the after
parameter for the connection:
This returns the data:
Last updated