|
Spring Data MongoDB - Core | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||
@Target(value=TYPE) @Documented @Retention(value=RUNTIME) public @interface CompoundIndex
Mark a class to use compound indexes.
| 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. |
String |
def
The actual index definition in JSON format. |
IndexDirection |
direction
Deprecated. |
boolean |
dropDups
|
int |
expireAfterSeconds
Deprecated. TTL cannot be defined for CompoundIndex having more than one field as key. Will be removed in
1.6. |
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
|
boolean |
useGeneratedName
If set to true then MongoDB will ignore the given index name and instead generate a new name. |
public abstract String def
@Deprecated public abstract IndexDirection direction
def()
attribute actually.
public abstract boolean unique
http://docs.mongodb.org/manual/core/index-unique/public abstract boolean sparse
http://docs.mongodb.org/manual/core/index-sparse/public abstract boolean dropDups
http://docs.mongodb.org/manual/core/index-creation/#index-creation-duplicate-droppingpublic abstract String name
@Document
class Root {
Hybrid hybrid;
Nested nested;
}
@Document
@CompoundIndex(name = "compound_index", def = "{'h1': 1, 'h2': 1}")
class Hybrid {
String h1, h2;
}
@CompoundIndex(name = "compound_index", def = "{'n1': 1, 'n2': 1}")
class Nested {
String n1, n2;
}
resolves in the following index structures
db.root.ensureIndex( { hybrid.h1: 1, hybrid.h2: 1 } , { name: "hybrid.compound_index" } )
db.root.ensureIndex( { nested.n1: 1, nested.n2: 1 } , { name: "nested.compound_index" } )
db.hybrid.ensureIndex( { h1: 1, h2: 1 } , { name: "compound_index" } )
public abstract boolean useGeneratedName
public abstract String collection
public abstract boolean background
http://docs.mongodb.org/manual/core/indexes/#background-construction@Deprecated public abstract int expireAfterSeconds
CompoundIndex having more than one field as key. Will be removed in
1.6.
http://docs.mongodb.org/manual/tutorial/expire-data/
|
Spring Data MongoDB - Core | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||