|
59 | 59 | import org.springframework.data.mongodb.core.query.Criteria;
|
60 | 60 | import org.springframework.data.mongodb.core.query.Query;
|
61 | 61 | import org.springframework.data.mongodb.core.query.TextQuery;
|
| 62 | +import org.springframework.data.mongodb.core.query.Update; |
62 | 63 |
|
63 | 64 | import com.mongodb.BasicDBObject;
|
64 | 65 | import com.mongodb.MongoClientSettings;
|
@@ -1326,6 +1327,25 @@ void mapStringIdFieldProjection() {
|
1326 | 1327 | org.bson.Document mappedFields = mapper.getMappedFields(new org.bson.Document("id", 1), context.getPersistentEntity(WithStringId.class));
|
1327 | 1328 | assertThat(mappedFields).containsEntry("_id", 1);
|
1328 | 1329 | }
|
| 1330 | + |
| 1331 | + @Test |
| 1332 | + void mapNestedStringFieldCorrectly() { |
| 1333 | + Update update = new Update(); |
| 1334 | + update.set("levelOne.a.b.d", "e"); |
| 1335 | + org.bson.Document document = mapper.getMappedObject(update.getUpdateObject(), |
| 1336 | + context.getPersistentEntity(EntityWithNestedMap.class)); |
| 1337 | + assertThat(document).isEqualTo(new org.bson.Document("$set",new org.bson.Document("levelOne.a.b.d","e"))); |
| 1338 | + } |
| 1339 | + |
| 1340 | + @Test |
| 1341 | + void mapNestedIntegerFieldCorrectly() { |
| 1342 | + Update update = new Update(); |
| 1343 | + update.set("levelOne.0.1.3", "4"); |
| 1344 | + org.bson.Document document = mapper.getMappedObject(update.getUpdateObject(), |
| 1345 | + context.getPersistentEntity(EntityWithNestedMap.class)); |
| 1346 | + assertThat(document).isEqualTo(new org.bson.Document("$set",new org.bson.Document("levelOne.0.1.3","4"))); |
| 1347 | + } |
| 1348 | + |
1329 | 1349 |
|
1330 | 1350 | @Test // GH-3783
|
1331 | 1351 | void retainsId$InWithStringArray() {
|
@@ -1514,6 +1534,11 @@ static class EntityWithIntKeyedMapOfMap{
|
1514 | 1534 | static class EntityWithComplexValueTypeList {
|
1515 | 1535 | List<SimpleEntityWithoutId> list;
|
1516 | 1536 | }
|
| 1537 | + |
| 1538 | + static class EntityWithNestedMap { |
| 1539 | + Map<String, Map<String, Map<String, Object>>> levelOne; |
| 1540 | + } |
| 1541 | + |
1517 | 1542 |
|
1518 | 1543 | static class WithExplicitTargetTypes {
|
1519 | 1544 |
|
|
0 commit comments