I have two classes mapped with MongoDB Grails PLUGIN like that:
Class Person:
class Person {
static mapWith="mongo"
String name
String email
static hasMany = [profiles: Profile]
static belongsTo = Profile
String toString(){
return name +" - " + (profiles)
} }
And Class Profile:
class Profile{
static mapWith="mongo"
String abbreviation
String description
static hasMany = [people: Person]
String toString(){
return abbreviation + " - " + description
}}
How can I make a query to return people per profile with finders provided by mongo?
A mongo query may be useful too!
This finder doesn't return anything
def people = Profile.findAllByAbbreviation("example").people
Sorry the english...
class Person { static mapWith="mongo"
String name
String email
List<Profile> profile= new ArrayList<Profile>();
static embedded = ['profile']
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.