Optimization of $match+$sort on aggregation pipeline

My initial suggestion was to create an index on all three fields ( {from:1,to:1,_id:1} ) - then the index would be used for both $match and $sort.

2 Likes