Reputation: 402
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?
Upvotes: 0
Views: 56
Reputation: 2330
Try it as part of the aggregation pipeline:
Demo - https://mongoplayground.net/p/LhTNE85OZVS
db.collection.aggregate([
{
$skip: 400
},
{
$limit: 100
},
{
$sample: {
size: 50
}
}
])
Upvotes: 2