Reading Time: < 1 minute
Here is the example of how you can do Pagination or Paging in MongoDB using Scala.
Note :-
1. pageNumber : Page No. like 1st Page , 2nd Page and so on.
2. messagesPerPage : No of messages to be displayed on each page.
3. Here the find method we’ve used is of SalatDAO. You can use your own find method.
Great post, however you typically never want to “skip” in mongodb; as it has to run through the entire index the further “the skip” you go. Take the last object ID and use that as the offset I.e. (_id $lte Y) + limit(X)
Great post, however you typically never want to \”skip\” in mongodb; as it has to run through the entire index the further \”the skip\” you go. Take the last object ID and use that as the offset I.e. (_id $lte Y) + limit(X)