문제

Grails 2.1.1, mongodb 1.0.0.GA.

I have two domain classes:

class Person {
  String firstName
  String lastName
  Address address
  static embedded = ['address']
}

class Address {
   String street
   String city
   String zip
}

I want to find all persons living in Redmond. I expect that something like:

Person.createCriteria().list() {
  eq 'address.city', 'Redmond'
}

would do the job but it does not. I know it is a 1st class citizen query for Mongo itself.

Is that not supported yet in mongodb 1.0.0.GA or I'm missing something obvious? I'm confused mostly because embedded documents is a bread and butter for mongo and not supporting such an obvious use case renders the whole plugin unusable.

도움이 되었습니까?

해결책

i tested your example (copy-pasted your code) and it worked fine without any errors.

Env: Grails 2.0.4, mongodb 1.0.0.GA

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top