Like this thousand users document i have in user collection MongoDb, Now I want to get only 50 results at a time in one page and that too users should be ordered in ascending order according to their name. So how can i achieve this without using third party pagination methods??
From mongo docs using $skip is often expensive because it requires the server to walk from the beginning of the collection. So, i am thinking to achieve this in different manner. Can u suggest is there any best way to achieve this?
In SQL one would do the same and depending on how good the index is, it’s walking the collection there every time.
Another possibility is to store the result in memory related to the session and paginate from there, but probably you will end up with the exact same walking from beginning everytime problem as well.