Image by gOrk barrette from Pixabay

When it comes to pagination, the simplest method that comes to mind is the skip-limit, but it is not always the best solution!

The Problem with the skip-limit

Although theskip-limit is suitable for some applications, it suffers from 2 major problems

As mentioned in MongoDB docs, it requires scanning all the previous docs before reaching the desired one, so it becomes slower as the offset increases. So the response times decline as page numbers increase.

The problem occurs meanwhile the user is exploring data and any doc being added or deleted simultaneously in the visited pages. it causes shifts in data which means we may…


Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store