aeischeid opened a new issue, #14415:
URL: https://github.com/apache/grails-core/issues/14415
Domains like `Certificate` and `SpecialCert extends Certificate`. Things
work well. `_class` is added to each document when doing inserts.
However, since upgrade to grails 2.5.2 and 3.0.3 version of the mongo plugin
I now have a problem when adding dynamic attributes before the first save. It
causes the _class not to be inserted into mongo, and this in turn causes
something like `SpecialCert.get(id)` to not return the document later.
There is a workaround. Just do the .save() first then add the props and do
another .save(), but it is a definite gotcha.
``` groovy
if (!specialCert.hasErrors()) {
specialCert.save()
// for some reason if we try to stamp the markerKey before the first
.save() GORM mongo
// loses that what class this is and misses putting the _class into the
DB causing probs later
String markerKey = ourService.getMarkerKey()
if (markerKey) specialCert['markerKey'] = markerKey
specialCert.save()
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]