Is mongoDB able to turn pages quickly?

  mongodb, question

Page turning uses limit plus the _id of the last bar of the first page of find to retrieve the contents of the second page.

However, even if the index is loaded into memory and 20 million documents are turned over, it takes more than 10 seconds for each page turn.

Is there any quick way to turn pages?

Thank you very much

First get the first id of the current page, then use this to get all the data of the next page:

db.collection.find({_id: {$gt: current_id}}).
 skip(page_size).
 limit(page_size).
 sort({_id: 1});

I have more than 6 million data, using this method is very fast.
If you are like this, it will take more than ten seconds, perhaps your query criteria are not indexed.


UseskipAddlimitYou can turn pages