-
Notifications
You must be signed in to change notification settings - Fork 199
Description
Original Reporter: dfischer
Environment: MacOSX, Grails 1.3.7
Version: 1.0.0.M6
Migrated From: http://jira.grails.org/browse/GPMONGODB-67
{code}
class MyObject {
String name
MyOtherObject otherObject
static constraints = {
otherObject nullable: true
}
}
{code}
{code}
create() {
def myOtherObject = new MyOtherObject().save()
new MyObject(name: "testing", otherObject: myOtherObject).save()
// everything works as expected at this point
}
update() {
def myObj = MyObject.get(id)
myObj.otherObject.delete()
// id of otherObject still exists on myObj
myObj.otherObject = null
// id of otherObject still exists on myObj
myObj.save()
// id of otherObject still exists on myObj
}
{code}
The problem is that because the otherObject id still set in the MyObject document, this causes issues when the otherObject is accessed.