We are using MongoDB plugin in Grails.
So I found this code, a domain object called Address
:
public class Address extends EmbededDomain{
static mapWith = "mongo"
Region region;
Zone zone;
static mapping = {
id generator: 'identity'
region reference:true
zone reference:true
}
}
EmbededDomain
is a class in src/groovy
class EmbeddedDomain {
public EmbeddedDomain() {
this.dateCreated = new Date()
this.lastUpdated = new Date()
}
}
Then I have Organization
domain with relationship Organization has Address:
class Organization {
static mapWith = "mongo"
Address address
static mapping = {
id generator: 'identity'
}
}
What does region reference:true
mean?
After saving anOrganization
when I enter the command show Collections
in my MongoDB console I am not seeing collection with name Address
? rather I am seeing collection with name EmbededDomain
which contains all the Address, why is this happening EmbededDomain
is just a Groovy class.