public final class Sort extends Object
MongoDB supports many different index types in addition to the simple
ascending and descending order. See the Index helper for more
information.
| Modifier and Type | Field and Description |
|---|---|
static int |
ASCENDING
The value to indicate an ascending sort order.
|
static int |
DESCENDING
The value to indicate an descending sort order.
|
| Modifier and Type | Method and Description |
|---|---|
static IntegerElement |
asc(String field)
Creates an ascending order specification, e.g.,
{ <field> : 1 }.
|
static IntegerElement |
desc(String field)
Creates an descending order specification, e.g.,
{ <field> : -1 }.
|
static StringElement |
geo2d(String field)
Deprecated.
Moved to the
Index class as Index.geo2d(java.lang.String) to
live with the other other index types. This method will be
removed after the 1.3.0 release. |
static IntegerElement |
natural()
Creates an natural ascending order sort specification, e.g.,
{ "$natural" : 1 }.
|
static IntegerElement |
natural(int direction)
Creates an natural order sort specification with the specified
ASCENDING or DESCENDING order, e.g.,
{ "$natural" : <direction> }. |
public static final int ASCENDING
public static final int DESCENDING
public static IntegerElement asc(String field)
This method is equivalent to Index.asc(String) method.
field - The field to create the ascending sort on.public static IntegerElement desc(String field)
This method is equivalent to Index.desc(String) method.
field - The field to create the descending sort on.@Deprecated public static StringElement geo2d(String field)
Index class as Index.geo2d(java.lang.String) to
live with the other other index types. This method will be
removed after the 1.3.0 release.field - The field to create the '2d' sort on.public static IntegerElement natural()
public static IntegerElement natural(int direction)
ASCENDING or DESCENDING order, e.g.,
{ "$natural" : <direction> }.direction - The direction for the natural ordering, either
ASCENDING or DESCENDING.Copyright © 2011–2014 Allanbank Consulting, Inc.. All rights reserved.