Closed
Description
Get rows from collection with pagination.
- Use aggregation
db.{dbname}.aggregate([{$sort:{_id:-1}}, {$skip:2}, {$limit:2}]); - Not use aggregation
db.{dbname}.find().sort({"_id":-1}).skip(2).limit(2)
The returned data sets are all the same but the time consumption are very different. So why use aggregation to paginate?
Metadata
Metadata
Assignees
Labels
No labels