Let's say we have a simple document type defined in mongodb:
{
_id : OjbectId(xxx),
value : A
}
But the value A here could be float, integer, boolean or string. How can I map it into a java entity?
Here's a template which only mapped _id:
@Document(collection = "my_document")
public class MyDocument {
@Id
private String id;
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
}
Thanks.
Object.