I am using skip limit and aggregate
but it's not working.
db.collation
.skip(400)
.limit(100)
.aggregate([{$sample: {size: 50}}])
What is the right way to do this?
CodePudding user response:
Try it as part of the aggregation pipeline:
Demo - https://mongoplayground.net/p/LhTNE85OZVS
db.collection.aggregate([
{
$skip: 400
},
{
$limit: 100
},
{
$sample: {
size: 50
}
}
])