I have added this to the code but it doesnt seem to be having any effect:
try {
cursor = await movies
.find(query).skip(moviesPerPage*page).limit(moviesPerPage)
.project(project)
.sort(sort)
}
Am I going in the right direction here?
edit: Is the try block being run everytime the user scrolls down and the page variable is being updated?
I think I can see the route of the problem, the getMovies function is being run everytime new movies are being shown on the screen but the cursor var doesn’t have anything limiting it. I doesnt seem to matter whether I call the .limit on it or not though, the value of the total number of movies does not change.