user.aggregate([
{
$match: {
age: { $gt: 18 },
city: { $in: ["chicago", "paris"] }
}
},
{
$sort: {
last_logged_in: -1
}
},
{
$limit: 10000
}
])
If the user collection is partitioned into 10 shards, will each shard return 10,000 documents, totalling to 100,000?
The answer is yes:
https://www.mongodb.com/docs/manual/core/sharded-cluster-query-router/#limits