I’ve implemented the paging code inside the getMoviesByGenre method, but, when I update the status page, I do not get the exercise code. The pagination works fine and the test (testPagingByGenre) is ok. I don’t know what might be wrong, maybe I have some difficulty in understanding, because, I know almost nothing of the English language.
Here is my code:
public List getMoviesByGenre(String sortKey, int limit, int skip, String… genres) {
// query filter
Bson castFilter = Filters.in(“genres”, genres);
// sort key
Bson sort = Sorts.descending(sortKey);
List movies = new ArrayList<>();
MongoCursor cursor = moviesCollection.find()
.filter(castFilter)
.skip(skip)
.limit(limit)
.sort(sort)
.iterator();
while (cursor.hasNext()){
movies.add(cursor.next());
}
return movies;
}
I appreciate any help, thank you.