Spring Data Document

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

Required Element Summary
 String def
          The actual index definition in JSON format.
 
Optional Element Summary
 String collection
          The collection the index will be created in.
 IndexDirection direction
          Deprecated. 
 boolean dropDups
           
 String name
          The name of the index to be created.
 boolean sparse
           
 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
Default:
false

sparse

public abstract boolean sparse
Default:
false

dropDups

public abstract boolean dropDups
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:
""

Spring Data Document

Copyright © 2012. All Rights Reserved.