public final class Index extends Object
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 IntegerElement asc(String field)
This method is equivalent to Sort.asc(String)
method.
field
- The field to create thepublic static IntegerElement desc(String field)
This method is equivalent to the Sort.desc(String)
method.
field
- The field to create thepublic static StringElement geo2d(String field)
field
- The field to create thepublic static StringElement geo2dSphere(String field)
field
- The field to create thepublic static StringElement geoHaystack(String field)
field
- The field to create thepublic static StringElement hashed(String field)
field
- The field to create thepublic static StringElement text(String field)
Note: 10gen 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 theCopyright © 2011-2013 Allanbank Consulting, Inc.. All Rights Reserved.