简体   繁体   中英

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!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM