Issue
This Content is from Stack Overflow. Question asked by Sameer Kamran
I am using Morphia 2.x, and I have a usecase where i want to save 1 Entity class into 2 different Collections.
However Morphia 2.x save
method doesn’t have any option to pass a Collection Name, Where as Morphia 1.x had this option.
I am not sure why they have removed this option.
@Entity
public class Unit {
@Id
private String id;
protected Unit() {
}
public String getId() {
return this.id;
}
public void setId(final String id) {
this.id = id;
}
}
Solution
Morphia 2.3 will reintroduce this functionality as an option passed via the alternateCollection
option on InsertOneOptions
(among other options classes). I’m working to get this out soon.
This Question was asked in StackOverflow by Sameer Kamran and Answered by evanchooly It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.