I am trying to update the Morphia version from 1.x to 2.x.
While doing that i have noticed that now the discriminator in the database is also changed.
previously it was className="app.package.className" and now it is changed to _t="className".
I found that we can explicitly mention the discriminatorKey and discriminator in the @Entity annotation as a parameter.
But still I am not very sure how can i migrate existing data to support the new discriminator in version 2.x.
@Entity(discriminatorKey="className", discriminator="Unit")
public class Unit {
@Id
private String id;
protected Unit() {
}
public String getId() {
return this.id;
}
public void setId(final String id) {
this.id = id;
}
}