Class Index
java.lang.Object
org.springframework.data.mongodb.core.index.Index
- All Implemented Interfaces:
IndexDefinition
- Direct Known Subclasses:
CompoundIndexDefinition, WildcardIndex
- Author:
- Oliver Gierke, Christoph Strobl, Mark Paluch
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDeprecated, for removal: This API element is subject to removal in a future version.since 5.0 for removal without replacement.expire(long value) Specifies TTL in seconds.Specifies TTL with givenTimeUnit.Specifies the TTL.org.bson.DocumentGet theDocumentcontaining properties covered by the index.org.bson.DocumentGet the index properties such as unique,...hidden()Hidden indexes are not visible to the query planner and cannot be used to support a query.on(String key, Sort.Direction direction) partial(@Nullable IndexFilter filter) Only index the documents in a collection that meet a specifiedfilter expression.sparse()Skip over any document that is missing the indexed field.toString()unique()Reject all documents that contain a duplicate value for the indexed field.
-
Constructor Details
-
Index
public Index() -
Index
-
-
Method Details
-
on
-
named
-
unique
-
sparse
-
background
Deprecated, for removal: This API element is subject to removal in a future version.since 5.0 for removal without replacement.Build the index in background (non blocking).NOTE: Since MongoDB 4.2 the background flag is ignored by the server if set.
- Returns:
- this.
- Since:
- 1.5
-
expire
-
expire
Specifies the TTL.- Parameters:
timeout- must not be null.- Returns:
- this.
- Throws:
IllegalArgumentException- if given timeout is null.- Since:
- 2.2
-
expire
-
partial
Only index the documents in a collection that meet a specifiedfilter expression.- Parameters:
filter- can be null.- Returns:
- this.
- Since:
- 1.10
- See Also:
-
collation
-
getIndexKeys
public org.bson.Document getIndexKeys()Description copied from interface:IndexDefinitionGet theDocumentcontaining properties covered by the index.- Specified by:
getIndexKeysin interfaceIndexDefinition- Returns:
- never null.
-
getIndexOptions
public org.bson.Document getIndexOptions()Description copied from interface:IndexDefinitionGet the index properties such as unique,...- Specified by:
getIndexOptionsin interfaceIndexDefinition- Returns:
- never null.
-
toString
-