Package dev.morphia.aggregation.stages
Class Sort
- java.lang.Object
-
- dev.morphia.aggregation.stages.Stage
-
- dev.morphia.aggregation.stages.Sort
-
public class Sort extends Stage
Sorts all input documents and returns them to the pipeline in sorted order.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Sort.Direction
The sort typesclass
Sort.SortType
-
Constructor Summary
Constructors Modifier Constructor Description protected
Sort()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Sort
ascending(String field, String... additional)
Adds an ascending sort definition on the field.Sort
descending(String field, String... additional)
Adds an descending sort definition on the field.List<Sort.SortType>
getSorts()
Sort
meta(String field)
Adds a sort by the computed textScore metadata in descending order.static Sort
on()
Deprecated, for removal: This API element is subject to removal in a future version.usesort()
static Sort
sort()
Creates a sort stage.-
Methods inherited from class dev.morphia.aggregation.stages.Stage
aggregation, stageName
-
-
-
-
Method Detail
-
on
@Deprecated(forRemoval=true) public static Sort on()
Deprecated, for removal: This API element is subject to removal in a future version.usesort()
Creates a sort stage.- Returns:
- the new stage
-
sort
public static Sort sort()
Creates a sort stage.- Returns:
- the new stage
- Since:
- 2.2
-
ascending
public Sort ascending(String field, String... additional)
Adds an ascending sort definition on the field.- Parameters:
field
- the sort fieldadditional
- any additional fields to sort on- Returns:
- this
-
descending
public Sort descending(String field, String... additional)
Adds an descending sort definition on the field.- Parameters:
field
- the sort fieldadditional
- any additional fields to sort on- Returns:
- this
-
getSorts
@MorphiaInternal public List<Sort.SortType> getSorts()
- Returns:
- the sorts
Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
-