'How to query data from mongodb batch by batch using nodejs and mongoose?
I need to query data from mongo collection where collection has 1 million records and it might grow. So what I need here is I need to query from mongo collection batch by batch (like pagination). As of now only idea I have is to limit and skip the records while querying like below.
Collection.find(query, fields, { skip: 100, limit: 100 }, function(err, results) { ... });
I heard using skip would again impact performance as it would go through each record of the collection from starting to skip. Is there any other optimized way here? Is there any concept of bookmarking in mongodb?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
