As per the aggregation pipeline optimization concepts, if you have a $sort followed by a $match:
Providing these parameters in any order does not impact the performance
$sort moves before $match
MongoDB does not do any movements by default and will use the order provided
$match moves before $sort
Submit