Dean Moses
Dean Moses

Reputation: 2382

Grails + MongoDB: what's a replacement for isNull criteria?

I'm testing a Grails model with MongoDB (mongodb plugin 1.0-M4)

I have a Category object that can have parent Category.

MongoDB doesn't support IsNull in criteria, so I can no longer do this to find parentless Categories:

Category.createCriteria().get {
    isNull('parent')
}

How do you find null HasOne relationships with MongoDB in Grails?

Thanks!

Upvotes: 1

Views: 637

Answers (1)

Medrod
Medrod

Reputation: 996

Category.createCriteria().get {
    eq('parent', null)
}

Upvotes: 3

Related Questions