Pagination info in query results

Hi there, when I execute a query I dont see any pagination info in results like which page number it is, total results etc. I am unable to find any info regarding this in docs can someone suggest how can this be retrieved ?

2 Likes

Hi @vishwajeets,

Unfortunately, this isn’t included in the query result. The only way you will know these values is you supply them.

query {
  items (limit: 15, page: 2) {
    id
  }
}

If you include these in the query like the above example, you will know which page you are on.

If there are no results, you will know that you have reached the end of results.

2 Likes

Got it not the best way but that’s fine.
May be running a while loop in this case would do the trick till you reach a point of no results or results less than the page limit.

1 Like

Hey @vishwajeets,

As @mitchell.hudson posted above, the best way to do this at moment would be to limit the query with a set limit and selecting the page. This is actually something we sometimes recommend for helping with query complexity if you are hitting a timeout or performance issues. This query can be used with some sort of loop as you mentioned in order to get the results until there are no more.

-Danny

1 Like