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 TypeMethodDescriptionBuild the index in background (non blocking).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(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
Reject all documents that contain a duplicate value for the indexed field.- Returns:
- this.
- See Also:
-
sparse
Skip over any document that is missing the indexed field.- Returns:
- this.
- See Also:
-
background
Build the index in background (non blocking).- Returns:
- this.
- Since:
- 1.5
-
expire
Specifies TTL in seconds.- Parameters:
value-- Returns:
- this.
- Since:
- 1.5
-
expire
Specifies the TTL.- Parameters:
timeout- must not be null.- Returns:
- this.
- Throws:
IllegalArgumentException- if given timeout is null.- Since:
- 2.2
-
expire
Specifies TTL with givenTimeUnit.- Parameters:
value-unit- must not be null.- Returns:
- this.
- Since:
- 1.5
-
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
Set theCollationto specify language-specific rules for string comparison, such as rules for lettercase and accent marks.
NOTE: Only queries using the sameCollationas theIndexactually make use of the index.- Parameters:
collation- can be null.- Returns:
- this.
- Since:
- 2.0
-
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
-