MongoDB Search Time and Number of Eligible Cases

  mongodb, question

图片描述

Similar to this, Baidu found a total of XXXXXX related results for you.
It takes XXXX.
How is this achieved?
Calculate all the numbers before pagination?
First, count = db.table.find().count ();
Then, db.table.find().skip().limit ();
Is that right?

There are still XXX milliseconds that are counted or paged. . .
Solving.

Look at your data level, if the data volume is not large, you can directly send all the data to the front end for paging. The advantage is that page turning can be realized by directly updating the page state without refreshing the page to send an update request. However, if it is a big data processing such as Baidu and Google, you need to declare the parameters when sending the request, and you need to declare the starting point of the data search and the data quantity, so the page turning is a separate data request. Mongo can directly db.table.count () to get the number of a collection. As for the search time, if I do it, I will calculate the length of time from sending the request to obtaining the response at the front end, or I can directly calculate the length of time required for database search at the back end, but I think this function is not important.