Class SortByCountOperation

java.lang.Object
org.springframework.data.mongodb.core.aggregation.SortByCountOperation
All Implemented Interfaces:
AggregationOperation

public class SortByCountOperation extends Object implements AggregationOperation
Encapsulates the aggregation framework $sortByCount-operation.
$sortByCount stage is typically used with Aggregation and $facet. Groups incoming documents based on the value of a specified expression and computes the count of documents in each distinct group. SortByCountOperation is equivalent to { $group: { _id: <expression>, count: { $sum: 1 } } }, { $sort: { count: -1 } }.
We recommend to use the static factory method Aggregation.sortByCount(String) instead of creating instances of this class directly.
Since:
2.1
Author:
Jérôme Guyon, Mark Paluch
See Also: