Automatic pagination in google-cloud-node

433 views Asked by At

The datastore nodejs docs mention that the client library will do automatic pagination by default:

By default, google-cloud-node will automatically paginate through all of the results that match a query. However, this sample implements manual pagination using limits and cursor tokens.

What is an example of automatic pagination?

1

There are 1 answers

0
Sai Pullabhotla On

Automatic Pagination, in this context, really means that the API would retrieve all results that match your query. By setting a limit and start cursor you limit the number of rows returned to a specific page. The example sets a limit of 5 rows, and uses a start cursor, so your results never exceed more than 5 entities. If you exclude the limit and start cursor (calls to the respective methods), you would get all the results.