I have an entity:
@Document(collection = "test")
public class Test{
@Id
@Field("_id")
private String id;
@Field("type")
private Type type;
...
}
it is enum:
public enum Type {
ONE("one"), TWO("two"), THREE("three");
private final String name;
Type (String name) {
this.name = name;
}
public String getName() {
return name;
}
}
But mongo collection has a String type of "type" field. How can I convert my enum to String?
findAllByType(Type type);