3.4 will introduce a number of new optimizations to the aggregation framework. Currently, the following optimizations have been implemented:
SERVER-22093, which allows aggregation to use a COUNT instead of a collection or index scan if no fields are needed from the resulting document.- SERVER-4507, which allows $group to become non-blocking if the stream of input documents is sorted by the fields used in the _id.
SERVER-20506, which allows $match after $unwind to move the subset of itself that is not dependent upon the unwound path before the $unwind, resulting in a second $match stage.