Spring Data MongoDB - Core

org.springframework.data.mongodb.core.index
Annotation Type CompoundIndex


@Target(value=TYPE)
@Documented
@Retention(value=RUNTIME)
public @interface CompoundIndex

Mark a class to use compound indexes.

Author:
Jon Brisbin, Oliver Gierke, Philipp Schneider, Johno Crawford

Required Element Summary
 String def
          The actual index definition in JSON format.
 
Optional Element Summary
 boolean background
          If true the index will be created in the background.
 String collection
          The collection the index will be created in.
 IndexDirection direction
          Deprecated. 
 boolean dropDups
           
 int expireAfterSeconds
          Configures the number of seconds after which the collection should expire.
 String name
          The name of the index to be created.
 boolean sparse
          If set to true index will skip over any document that is missing the indexed field.
 boolean unique
           
 

Element Detail

def

public abstract String def
The actual index definition in JSON format. The keys of the JSON document are the fields to be indexed, the values define the index direction (1 for ascending, -1 for descending).

Returns:

direction

@Deprecated
public abstract IndexDirection direction
Deprecated. 

It does not actually make sense to use that attribute as the direction has to be defined in the def() attribute actually.

Returns:
Default:
org.springframework.data.mongodb.core.index.IndexDirection.ASCENDING

unique

public abstract boolean unique
Returns:
See Also:
http://docs.mongodb.org/manual/core/index-unique/
Default:
false

sparse

public abstract boolean sparse
If set to true index will skip over any document that is missing the indexed field.

Returns:
See Also:
http://docs.mongodb.org/manual/core/index-sparse/
Default:
false

dropDups

public abstract boolean dropDups
Returns:
See Also:
http://docs.mongodb.org/manual/core/index-creation/#index-creation-duplicate-dropping
Default:
false

name

public abstract String name
The name of the index to be created.

Returns:
Default:
""

collection

public abstract String collection
The collection the index will be created in. Will default to the collection the annotated domain class will be stored in.

Returns:
Default:
""

background

public abstract boolean background
If true the index will be created in the background.

Returns:
See Also:
http://docs.mongodb.org/manual/core/indexes/#background-construction
Default:
false

expireAfterSeconds

public abstract int expireAfterSeconds
Configures the number of seconds after which the collection should expire. Defaults to -1 for no expiry.

Returns:
See Also:
http://docs.mongodb.org/manual/tutorial/expire-data/
Default:
-1

Spring Data MongoDB - Core

Copyright © 2011-2013-2014 Pivotal. All Rights Reserved.