Let's say I have a MongoDB object that looks like this:
@Entity(value = "car")
public class Car {
public String manufacturer;
public String model;
public String year;
public Double price;
}
I would like to add an index so that the pair is manufacturer,model,yearunique.
When I try the following annotation - @Indexes(@Index(value="manufacturer,model,year, unique=true))- it works. But this causes the following error:
[WARN] (main) : DatastoreImpl - This index on 'Car' is using deprecated configuration options. Please update to use the fields value on @Index: @org.mongodb.morphia.annotations.Index(unique=true, dropDups=false, background=false, name=, value=manufacturer, model, year, expireAfterSeconds=-1, disableValidation=false, sparse=false, fields=[], options=@org.mongodb.morphia.annotations.IndexOptions(unique=false, dropDups=false, background=false, name=, expireAfterSeconds=-1, disableValidation=false, language=, languageOverride=, sparse=false))
How to configure the index?
source
share