File tree Expand file tree Collapse 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 Expand file tree Collapse file tree 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) {
12611261
12621262 String partial = iterator .next ();
12631263
1264- boolean isPositional = ( isPositionalParameter (partial ) && ( property .isMap () || property . isCollectionLike ()) );
1264+ boolean isPositional = isPositionalParameter (partial ) && property .isCollectionLike ();
12651265
1266- if (isPositional ) {
1266+ if (isPositional || property . isMap () ) {
12671267 mappedName .append ("." ).append (partial );
12681268 }
12691269
Original file line number Diff line number Diff line change @@ -1089,6 +1089,27 @@ void mappingShouldAllowNestedPositionParameterWithIdentifierWhenFieldHasExplicit
10891089 assertThat (mappedUpdate ).isEqualTo (new Document ("$set" , new Document ("aliased.$[element].value" , 10 )));
10901090 }
10911091
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+
10921113 static class DomainTypeWrappingConcreteyTypeHavingListOfInterfaceTypeAttributes {
10931114 ListModelWrapper concreteTypeWithListAttributeOfInterfaceType ;
10941115 }
You can’t perform that action at this time.
0 commit comments