public class WildcardIndex extends Index
WildcardIndex is a specific Index that can be used to include all fields into an index based on the
$**" : 1 pattern on a root object (the one typically carrying the
Document annotation). On those it is possible to use
wildcardProjectionInclude(String...) and wildcardProjectionExclude(String...) to define specific
paths for in-/exclusion.
"path.to.field.$**" : 1. Index.Duplicates| Constructor and Description |
|---|
WildcardIndex()
Create a new instance of
WildcardIndex using $**. |
WildcardIndex(String path)
Create a new instance of
WildcardIndex for the given path. |
| Modifier and Type | Method and Description |
|---|---|
Index |
expire(Duration duration)
ttl option is not supported.
|
Index |
expire(long seconds)
ttl option is not supported.
|
Index |
expire(long value,
TimeUnit timeUnit)
ttl option is not supported.
|
org.bson.Document |
getIndexKeys()
Get the
Document containing properties covered by the index. |
org.bson.Document |
getIndexOptions()
Get the index properties such as unique,...
|
WildcardIndex |
includeId()
Include the
_id field in wildcardProjection. |
WildcardIndex |
named(String name)
Set the index name to use.
|
Index |
unique()
Unique option is not supported.
|
WildcardIndex |
wildcardProjection(Map<String,Object> includeExclude)
Set the fields to be in-/excluded from indexing via
wildcardProjection. |
WildcardIndex |
wildcardProjectionExclude(String... paths)
Add fields to be excluded from indexing via
wildcardProjection. |
WildcardIndex |
wildcardProjectionInclude(String... paths)
Add fields to be included from indexing via
wildcardProjection. |
public WildcardIndex()
WildcardIndex using $**.public WildcardIndex(@Nullable String path)
WildcardIndex for the given path. If no path is provided the
index will be considered a root one using $**. wildcardProjectionInclude(String...), wildcardProjectionExclude(String...)
can only be used for top level index definitions having an empty or null path.path - can be null. If null all fields will be indexed.public WildcardIndex includeId()
_id field in wildcardProjection.public WildcardIndex named(String name)
public Index unique()
unique in class IndexUnsupportedOperationException - not supported for wildcard indexes.public Index expire(long seconds)
expire in class IndexUnsupportedOperationException - not supported for wildcard indexes.public Index expire(long value, TimeUnit timeUnit)
expire in class IndextimeUnit - must not be null.UnsupportedOperationException - not supported for wildcard indexes.public Index expire(Duration duration)
expire in class Indexduration - must not be null.UnsupportedOperationException - not supported for wildcard indexes.public WildcardIndex wildcardProjectionInclude(String... paths)
wildcardProjection. top level wildcard indexes.paths - must not be null.public WildcardIndex wildcardProjectionExclude(String... paths)
wildcardProjection. top level wildcard indexes.paths - must not be null.public WildcardIndex wildcardProjection(Map<String,Object> includeExclude)
wildcardProjection. top level wildcard indexes.includeExclude - must not be null.public org.bson.Document getIndexKeys()
IndexDefinitionDocument containing properties covered by the index.getIndexKeys in interface IndexDefinitiongetIndexKeys in class Indexpublic org.bson.Document getIndexOptions()
IndexDefinitiongetIndexOptions in interface IndexDefinitiongetIndexOptions in class IndexCopyright © 2011–2022 Pivotal Software, Inc.. All rights reserved.