public class Index extends Object implements IndexDefinition
| Modifier and Type | Class and Description |
|---|---|
static class |
Index.Duplicates |
| Constructor and Description |
|---|
Index() |
Index(String key,
Order order)
Deprecated.
use
#Index(String, Direction) instead. |
Index(String key,
Sort.Direction direction) |
| Modifier and Type | Method and Description |
|---|---|
Index |
background()
Build the index in background (non blocking).
|
Index |
expire(long value)
Specifies TTL in seconds.
|
Index |
expire(long value,
TimeUnit unit)
Specifies TTL with given
TimeUnit. |
com.mongodb.DBObject |
getIndexKeys() |
com.mongodb.DBObject |
getIndexOptions() |
Index |
named(String name) |
Index |
on(String key,
Order order)
Deprecated.
use
#on(String, Direction) instead. |
Index |
on(String key,
Sort.Direction direction) |
Index |
sparse()
Skip over any document that is missing the indexed field.
|
String |
toString() |
Index |
unique()
Reject all documents that contain a duplicate value for the indexed field.
|
Index |
unique(Index.Duplicates duplicates) |
public Index()
public Index(String key, Sort.Direction direction)
@Deprecated public Index(String key, Order order)
#Index(String, Direction) instead.key - must not be null or empty.order - must not be null.@Deprecated public Index on(String key, Order order)
#on(String, Direction) instead.key - must not be null or empty.order - must not be null.public Index on(String key, Sort.Direction direction)
public Index unique()
http://docs.mongodb.org/manual/core/index-unique/public Index sparse()
http://docs.mongodb.org/manual/core/index-sparse/public Index background()
public Index expire(long value)
value - public Index expire(long value, TimeUnit unit)
TimeUnit.value - unit - public Index unique(Index.Duplicates duplicates)
duplicates - http://docs.mongodb.org/manual/core/index-creation/#index-creation-duplicate-droppingpublic com.mongodb.DBObject getIndexKeys()
getIndexKeys in interface IndexDefinitionpublic com.mongodb.DBObject getIndexOptions()
getIndexOptions in interface IndexDefinitionCopyright © 2011-2014–2014 Pivotal Software, Inc.. All rights reserved.