【发布时间】:2013-03-22 12:14:32
【问题描述】:
我有两个类用 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
对不起英文...
【问题讨论】:
-
Profile.findAllByAbbreviation("example")*.people ?