public class Index extends Object implements IndexDefinition
| Modifier and Type | Class and Description |
|---|---|
static class |
Index.Duplicates
Deprecated.
since 2.1. No longer supported by MongoDB as of server version 3.0.
|
| Constructor and Description |
|---|
Index() |
Index(String key,
Sort.Direction direction) |
| Modifier and Type | Method and Description |
|---|---|
Index |
background()
Build the index in background (non blocking).
|
Index |
collation(Collation collation)
Set the
Collation to specify language-specific rules for string comparison, such as rules for lettercase
and accent marks. |
Index |
expire(Duration timeout)
Specifies the TTL.
|
Index |
expire(long value)
Specifies TTL in seconds.
|
Index |
expire(long value,
TimeUnit unit)
Specifies TTL with given
TimeUnit. |
org.bson.Document |
getIndexKeys() |
org.bson.Document |
getIndexOptions() |
Index |
named(String name) |
Index |
on(String key,
Sort.Direction direction) |
Index |
partial(IndexFilter filter)
Only index the documents in a collection that meet a specified
filter expression. |
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.
|
public Index()
public Index(String key, Sort.Direction direction)
public Index on(String key, Sort.Direction direction)
public Index unique()
public Index sparse()
public Index background()
public Index expire(long value)
value - public Index expire(Duration timeout)
timeout - must not be null.IllegalArgumentException - if given timeout is null.public Index expire(long value, TimeUnit unit)
TimeUnit.value - unit - public Index partial(@Nullable IndexFilter filter)
filter expression.filter - can be null.public Index collation(@Nullable Collation collation)
Collation to specify language-specific rules for string comparison, such as rules for lettercase
and accent marks.Collation as the Index actually make use of the
index.collation - can be null.public org.bson.Document getIndexKeys()
getIndexKeys in interface IndexDefinitionpublic org.bson.Document getIndexOptions()
getIndexOptions in interface IndexDefinitionCopyright © 2011–2020 Pivotal Software, Inc.. All rights reserved.