$sort should be pushed automatically before $unwind if sort is happening on a different field.
E.g.
db.foo.aggregation([{$unwind: "fieldA"},{$sort: { fieldB: 1}}])
- is related to
-
SERVER-26442 Push $sort before $project and $addFields
- Open
- related to
-
SERVER-55417 Conditionally reorder $sort and $lookup depending on whether the query planner allows for an index-provided sort
- Backlog