Compound Index (Multi-Field-Index)
Combining multiple fields to one identifier/index.
// Lombok's annotations go here..
// Creating new multi-field index, a so called CompoundIndex
@CompoundIndex({@Index("firstName"), @Index(value = "lastName", ascending = false)}) // en2do
@CompoundIndex(value = {@Index("uniqueId"), @Index("firstName")}, uniqueIndex = true) // en2do
public class Customer {
@Id // en2do
UUID uniqueId;
String firstName;
String lastName;
// Other fields go here...
}Last updated