How do I paginate an array of _id in mongoose? [duplicate] How do I paginate an array of _id in mongoose? [duplicate] mongoose mongoose

How do I paginate an array of _id in mongoose? [duplicate]


You can do the pagination on the client side, this way you'll get all the products from the server, but display only five on the client.It will allow you calculate the average or other calculation on all the data. also it will allow you filtering and sorting all the data.

If you have a large amount of data, it will take long time for the first time for the client to load the data from the server, so for large amount of data it may be not the right way to go, in this case you probably want to load the data in chuncks, and maybe in the background, and perform the calculation using the server maybe also in the background -for optimization.

You can find pros and cons of server/client pagentaion https://dzone.com/articles/pagination-server-side-or-clie