Hello, from minute 06:42 you can see that page 1's first doc is the movie Divergent, and then when you switch to page 2 the same movie shows up. The same thing is happening to me. Because of this some movies are not shown in any of the pages. Any solution? Thank you in advance and congratulations for this course.
Ok I figured it out. Found this on the internet: "We recommend always using limit() with sort(). If you don't specify sort(), the MongoDB server doesn't guarantee you'll get the results back in any particular order." Since we were setting a default sorting by -createdAt, and that property had the same value in all docs (since they were all imported at the same time from the json file), the sorting wasn't giving any effective order to the list. Changed the default sort to '-name' and it worked perfectly.
Using pagination will break the filter method as it will modify the query at the end. Thus, in Postman, we will obtain all movie lists when filtering as defined by const limit = (entered limit is empty when filtering) || 10 .
delete querryObj.page; delete querryObj.limit; delete querryObj.sort delete querryObj.fields console.log(querryObj); let query = Movie.find(querryObj); add this if pagination is not working