codeconsole commented on code in PR #15583:
URL: https://github.com/apache/grails-core/pull/15583#discussion_r3164524832
##########
grails-data-mongodb/core/src/main/groovy/org/grails/datastore/mapping/mongo/engine/codecs/PersistentEntityCodec.groovy:
##########
@@ -361,7 +361,40 @@ class PersistentEntityCodec extends
BsonPersistentEntityCodec {
}
}
else {
- // TODO: Support non-dirty checkable objects?
+ // Non-DirtyCheckable values: no per-property change history
available,
+ // so when the caller is encoding this as an embedded update
(null→non-null
+ // transition on a single-valued embedded field), encode every
persistent
+ // property. Without this, the parent's $set on the embedded path
stays
+ // empty and the sub-document is silently dropped.
+ if (embedded) {
Review Comment:
(1) Nested embedded recurses through encodeEmbeddedUpdate ->
encodeUpdate(embedded=true) and re-enters the same else-if branch, writing
_class at each non-root level. (2) Branches are mutually exclusive: POGOs that
have markDirty() called on them must implement DirtyCheckable, so cannot reach
this branch. No double-encode possible. No fix needed.
--
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]