Good day! I do pagination. To create it, I need information about the number of documents satisfying the request. Using count() own, I can do it. But I know that several methods / conditions can be added to the request. For example,

 collection.find({"age":20}).skip(3).limit(2).toArray(function(err, result){ if (err) throw err; console.log(result); db.close(); }); 

Is it possible to add count() to this query to get the total number of documents that match the query? Or can it be possible, from a request that is shown above, to somehow pull out differently the information I need?

1 answer 1

The answer is no. Need two requests