Skip to content

Update path not correctly mapped when last segment is multi digit number #4426

Closed
@juzq

Description

@juzq

in UpdateMapperUnitTests#mapNestedIntegerFieldCorrectly, when change the last integer to grater than 10, like this:

    @Test
    void mapNestedIntegerFieldCorrectly() {

        Update update = new Update().set("levelOne.0.1.32", "4");
        Document mappedUpdate = mapper.getMappedObject(update.getUpdateObject(),
            context.getPersistentEntity(EntityWithNestedMap.class));

        assertThat(mappedUpdate).isEqualTo(new org.bson.Document("$set", new org.bson.Document("levelOne.0.1.32", "4")));
    }

then add a 2rd field in EntityWithNestedMap, like this:

	static class EntityWithNestedMap {
		Map<String, Map<String, Map<String, Object>>> levelOne;
		Map<String, Map<String, Map<String, Object>>> levelOne2;
	}

then, the test fails.

Expected :{"$set"={"levelOne.0.1.32"="4"}}
Actual :{"$set"={"levelOne2.0"="4"}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions