Quick Tip : Pagination in MongoDB using Scala

Table of contents
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.

2 thoughts on “Quick Tip : Pagination in MongoDB using Scala1 min read

  1. 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)

  2. 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)

Comments are closed.

Discover more from Knoldus Blogs

Subscribe now to keep reading and get access to the full archive.

Continue reading