$sort should be pushed before $lookup if we are sorting on the "left" collection:
E.g.
db.foo.aggregate([ {$lookup: {from: "new", localField: "_id", foreignField: "_id", as: "list"}}, {$sort: {b: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