0

次のように、MongoDBGrailsPLUGINでマップされた2つのクラスがあります。

クラスの人:

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

class Person { static mapWith="mongo"

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

static embedded = ['profile']

}

于 2014-01-10T11:10:03.327 に答える