0

我有两个用MongoDB Grails PLUGIN映射的类:

班级人:

class Person {
     static mapWith="mongo"

     String name
     String email

     static hasMany = [profiles: Profile]

     static belongsTo = Profile


     String toString(){
        return name +" - " + (profiles)
}   }

和班级简介:

class Profile{

static mapWith="mongo"

String abbreviation
String description
static hasMany = [people: Person]



String toString(){
    return abbreviation + " - " + description
}}

如何使用 mongo 提供的查找器进行查询以根据个人资料返回人员?

mongo 查询也可能有用!

此查找器不返回任何内容

def people = Profile.findAllByAbbreviation("example").people

对不起英文...

4

1 回答 1

0

类人 { 静态 mapWith="mongo"

 String name
 String email
List<Profile> profile= new ArrayList<Profile>();

static embedded = ['profile']

}

于 2014-01-10T11:10:03.327 回答