How can I work with complex types in Spring Data + Mongo?
Like:
class Person {
@Id
String id;
String name;
//What can I do?
Address address
//OR
String adressId;
}
How can I build this object for server side use?
I want to use adressId, but I don't know how to proceed when I need to use the address within some method.
For example:
void doWithPerson(Person person){
System.out.println(person.getAdress());//this doesn't exist with adressId
}
Edit:
I want the mongo object as:
{
id: 1
name: 'Test'
addressId: 1//not the complext object
}
and in addressCollection:
{
id: 1
address: 'Some info'
}