I am using below query to fetch the data from mongoDB
collection.find({_id: "34534534"}, { cont: {$slice:[count,10]} })
each time when I call this query it returns the data of 10 records and count is the variable which keeps on changing like -30,-40, etc. How to know that query has reached to last 10 record?
collection.find({_id: "34534534"}, { cont: {$slice:[count,11]} })
Just change the limit to 11. The elapsed time is nearly equal to your code, but give you the chance to see if has more records.