I have a relatively large dataset that i need to rank, dividing by multiple partisions using $setWindowFields. Approximately 155k documents to rank.
Is there any way to speed this part of my aggregation up. If i run an explain on the aggregation, the sorting part of the $setWindowFields is what is taking the longest - upto 6 seconds.
Any ideas?
{
partitionBy : {
age : '$age',
gender : '$gender.id',
},
sortBy : {
dob: 1,
},
output : {
rank: {
$rank : {
}
},
}
}