You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When updating a field of type Map that has a fieldName annotation (@Embedded or @Property), then an update on that field does not replace the field's name with the provided value.
results in mongo: { "_id": { "$oid": "587609d12e934813a926ec69" }, "c": { "key": "value" }, "content": { "key": "newValue" } }
Note that the Document contains now both "c" and "content". The update returns without error and subsequent retrievals will ignore this update.
commit 97dcaf1
Author: Daniel Breitlauch <daniel.breitlauch@researchgate.net>
Date: Wed Jan 11 16:02:07 2017 +0100
always translate according to annotation + unit test to verify
fixes#1124fixes#1123
(cherry picked from commit f571dad)
Hello,
This is a critical bug.
When updating a field of type Map that has a fieldName annotation (@Embedded or @Property), then an update on that field does not replace the field's name with the provided value.
POJO
class Payload {
@id
private ObjectId id;
Update
ds.createUpdateOperations(Payload.class) .set("content.key", "newValue");
results in mongo:
{ "_id": { "$oid": "587609d12e934813a926ec69" }, "c": { "key": "value" }, "content": { "key": "newValue" } }
Note that the Document contains now both "c" and "content". The update returns without error and subsequent retrievals will ignore this update.
This behaviour was introduced in commit d0d9e04
Attached is patch that contains a unitTest to reproduce the issue. (had to rename from .patch to .TXT got github )
testUpdatingMapFieldsAnnotatedWithFieldNames.TXT
The text was updated successfully, but these errors were encountered: