Are there any good Practices for using Dynomoose.js to implement pagination with Angular. I would like to use scan.limit() in order to get some amount of Movies from the DB, for example, 20. How do I get the second scan 20-40 Movies and 40-60 Movies? Should I use scan.startAt(key) in order to retrieve further data?
exports.listing = (req, res, next) => {
MoviesModel.scan()
.exec()
.then(movies=> {
if(movies.lastKey){
MovieModel.scan().startAt(movies.lastKey).exec(function(err, movies){
res.json(movies);
});
}
})
.catch(err => next(err));
};