I have over 300k records in one collection in Mongo.
When I run this very simple query:
db.myCollection.find().limit(5);
It takes only few miliseconds.
But when I use skip in the query:
db.myCollection.find().skip(200000).limit(5)
It won’t return anything… it runs for minutes and returns nothing.
How to make it better?
From MongoDB documentation:
You have to ask yourself a question: how often do you need 40000th page? Also see this article;