Skip to content

GPMONGODB-61: Duplicity when calling save() from a domain class instance #85

@graemerocher

Description

@graemerocher

Original Reporter: emedina
Environment: All
Version: 1.0.0.M6
Migrated From: http://jira.grails.org/browse/GPMONGODB-61

No matter how I try to save a domain class instance, it always results in double save operation. It seems that, at calling save(), the domain class instance is placed in pending inserts and when executing the save operation, it's saved once from the pending inserts and then again as part of the save operation itself.

If I try to save within a "withTransaction", then I get this error in MongoDB:

Fri Jun 3 13:33:38 [conn33] insert Doublesave.user 19ms
Fri Jun 3 13:33:38 [conn33] insert Doublesave.user exception 11000 E11000 duplicate key error index: Doublesave.user.$id dup key: { : 1 } 0ms

If I simply call "save(flush: true")" then I get this error:

Fri Jun 3 13:33:38 [conn33] insert Doublesave.user 0ms
Fri Jun 3 13:33:38 [conn33] insert Doublesave.user exception 11000 E11000 duplicate key error index: Doublesave.user.$id dup key: { : 2 } 0ms

Please execute attached sample app with a MongoDB running in default port.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions