package org.mongodb.morphia.aggregation;

Defines a sort stage in an aggregation pipeline
@mongodb.driver.manualreference/operator/aggregation/sort/ $sort
Deprecated:Use Sort instead.
/** * Defines a sort stage in an aggregation pipeline * * @mongodb.driver.manual reference/operator/aggregation/sort/ $sort * @deprecated Use {@link org.mongodb.morphia.query.Sort} instead. */
@Deprecated public class Sort extends org.mongodb.morphia.query.Sort {
Creates a sort on a field with a direction.
  • 1 to specify ascending order.
  • -1 to specify descending order.
Params:
  • field – the field
  • direction – the direction
/** * Creates a sort on a field with a direction. * <ul> * <li>1 to specify ascending order.</li> * <li>-1 to specify descending order.</li> * </ul> * * @param field the field * @param direction the direction */
public Sort(final String field, final int direction) { super(field, direction); }
Creates an ascending sort on a field
Params:
  • field – the field
Returns:the Sort instance
Deprecated:Use Sort.ascending(String) instead.
/** * Creates an ascending sort on a field * * @param field the field * @return the Sort instance * @deprecated Use {@link org.mongodb.morphia.query.Sort#ascending(String)} instead. */
@Deprecated public static Sort ascending(final String field) { return new Sort(field, 1); }
Creates a descending sort on a field
Params:
  • field – the field
Returns:the Sort instance
Deprecated:Use Sort.descending(String) instead.
/** * Creates a descending sort on a field * * @param field the field * @return the Sort instance * @deprecated Use {@link org.mongodb.morphia.query.Sort#descending(String)} instead. */
@Deprecated public static Sort descending(final String field) { return new Sort(field, -1); }
Returns:the sort direction
Deprecated:Use Sort.getOrder() instead.
/** * @return the sort direction * @deprecated Use {@link org.mongodb.morphia.query.Sort#getOrder()} instead. */
@Deprecated public int getDirection() { return super.getOrder(); } }