public final class Index extends Object
Modifier and Type | Field and Description |
---|---|
static int |
ASCENDING
The value to indicate an ascending index order.
|
static int |
DESCENDING
The value to indicate an descending index order.
|
static String |
GEO_2D_INDEX_NAME
The value for the "2d" index.
|
static String |
GEO_2DSPHERE_INDEX_NAME
The value for the "2dsphere" index.
|
static String |
GEO_HAYSTACK_INDEX_NAME
The value for the "geoHaystack" index.
|
static String |
HASHED_INDEX_NAME
The value for the "hashed" index.
|
static String |
TEXT_INDEX_NAME
The value for the "text" index.
|
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)
Creates an 2D index specification, e.g.,
{ <field> : "2d" }.
|
static StringElement |
geo2dSphere(String field)
Creates an 2D Sphere index specification, e.g.,
{ <field> : "2dsphere" }.
|
static StringElement |
geoHaystack(String field)
Creates a haystack index specification, e.g.,
{ <field> : "geoHaystack" }.
|
static StringElement |
hashed(String field)
Creates an 'hashed' index specification, e.g.,
{ <field> : "hashed" }.
|
static StringElement |
text(String field)
Creates an 'text' index specification, e.g.,
{ <field> : "text" }.
|
public static final int ASCENDING
public static final int DESCENDING
public static final String GEO_2D_INDEX_NAME
public static final String GEO_2DSPHERE_INDEX_NAME
public static final String GEO_HAYSTACK_INDEX_NAME
public static final String HASHED_INDEX_NAME
public static final String TEXT_INDEX_NAME
public static IntegerElement asc(String field)
This method is equivalent to Sort.asc(String)
method.
field
- The field to create the ascending index on.public static IntegerElement desc(String field)
This method is equivalent to the Sort.desc(String)
method.
field
- The field to create the descending index on.public static StringElement geo2d(String field)
field
- The field to create the '2d' index on.public static StringElement geo2dSphere(String field)
field
- The field to create the '2dsphere' index on.public static StringElement geoHaystack(String field)
field
- The field to create the 'geoHaystack' index on.public static StringElement hashed(String field)
field
- The field to create the 'hashed' index on.public static StringElement text(String field)
Note: MongoDB Inc. considers text indexes to be an experimental feature in the 2.4 release. Use with extreme caution. At a minimum make sure you have read the MongoDB Text Index Documentation.
field
- The field to create the 'text' index on.Copyright © 2011–2014 Allanbank Consulting, Inc.. All rights reserved.