mongodb - Is there a 'contains' functionality on a collection of ObjectId property of a domain object for withCriteria? -
i have subscription domain object has list of objectid 1 of properties, 'subscribed'. i'm on grails 2.1.2 , mongodb.
class subscription { objectid id list<objectid> subscribers = [] list<objectid> static mapwith = "mongo" } i'm looking this
def c = subscription.withcriteria { contains("subscribers", specificid) } is there way this?
note: i'm aware of this same question provided answer question doesn't work property of type list of objectid.
see grails criteria docs. try use this:
def c = subscription.withcriteria { subscribers{ eq("id",specificid) } }
Comments
Post a Comment