Module spring.data.mongodb
Annotation Interface HashIndexed
Annotation for a property that should be used as key for a
Hashed Index. If used on a simple property, the
index uses a hashing function to compute the hash of the value of the index field. Added to a property of complex
type the embedded document is collapsed and the hash computed for the entire object.
@Document
public class DomainType {
@HashIndexed @Id String id;
}
HashIndexed can also be used as meta Annotation to create composed annotations:
@Indexed
@HashIndexed
@Retention(RetentionPolicy.RUNTIME)
public @interface IndexAndHash {
@AliasFor(annotation = Indexed.class, attribute = "name")
String name() default "";
}
@Document
public class DomainType {
@ComposedHashIndexed(name = "idx-name") String value;
}
- Since:
- 2.2
- Author:
- Christoph Strobl
- See Also: