clarkie / dynogels

DynamoDB data mapper for node.js. Originally forked from https://github.com/ryanfitz/vogels

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

paginated requests

cdelgadob opened this issue · comments

I need to make an infinite scroll in my UI, and for that I plan to use cursors inqueries to dynamodb

I have been diving into the code and saw that there's a paginatedRequest method in utils.js, which I couldn't find in the documentation - see here

Would this method work for request where I can set a cursos and a number of records to retrieve or should I use the low-level dynamodb API to achieve this?

Thanks in advance

Carlos

You can use .query(...).limit(n) to limit the results to n objects. If there is possibly more data beyond the limited results, the returned data will include an ExclusiveStartKey attribute, which you can pass to the .startKey() query method to obtain the next page. See the query documentation.