File tree 2 files changed +23
-2
lines changed
main/java/org/springframework/data/mongodb/core/convert
test/java/org/springframework/data/mongodb/core/convert
2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -1261,9 +1261,9 @@ protected String mapPropertyName(MongoPersistentProperty property) {
1261
1261
1262
1262
String partial = iterator .next ();
1263
1263
1264
- boolean isPositional = ( isPositionalParameter (partial ) && ( property .isMap () || property . isCollectionLike ()) );
1264
+ boolean isPositional = isPositionalParameter (partial ) && property .isCollectionLike ();
1265
1265
1266
- if (isPositional ) {
1266
+ if (isPositional || property . isMap () ) {
1267
1267
mappedName .append ("." ).append (partial );
1268
1268
}
1269
1269
Original file line number Diff line number Diff line change @@ -1089,6 +1089,27 @@ void mappingShouldAllowNestedPositionParameterWithIdentifierWhenFieldHasExplicit
1089
1089
assertThat (mappedUpdate ).isEqualTo (new Document ("$set" , new Document ("aliased.$[element].value" , 10 )));
1090
1090
}
1091
1091
1092
+ @ Test // GH-3552
1093
+ void numericKeyForMap () {
1094
+
1095
+ Update update = new Update ().set ("map.601218778970110001827396" , "testing" );
1096
+ Document mappedUpdate = mapper .getMappedObject (update .getUpdateObject (),
1097
+ context .getPersistentEntity (EntityWithObjectMap .class ));
1098
+
1099
+ assertThat (mappedUpdate ).isEqualTo (Document .parse ("{\" $set\" : {\" map.601218778970110001827396\" : \" testing\" }}" ));
1100
+ }
1101
+
1102
+ @ Test // GH-3552
1103
+ void numericKeyInMapOfNestedPath () {
1104
+
1105
+ Update update = new Update ().set ("map.601218778970110001827396.value" , "testing" );
1106
+ Document mappedUpdate = mapper .getMappedObject (update .getUpdateObject (),
1107
+ context .getPersistentEntity (EntityWithObjectMap .class ));
1108
+
1109
+ assertThat (mappedUpdate )
1110
+ .isEqualTo (Document .parse ("{\" $set\" : {\" map.601218778970110001827396.value\" : \" testing\" }}" ));
1111
+ }
1112
+
1092
1113
static class DomainTypeWrappingConcreteyTypeHavingListOfInterfaceTypeAttributes {
1093
1114
ListModelWrapper concreteTypeWithListAttributeOfInterfaceType ;
1094
1115
}
You can’t perform that action at this time.
0 commit comments