Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
juzq opened this issue Jun 26, 2023 · 1 comment
Closed
Labels
type: bug A general bug

Comments

@juzq
Copy link

juzq commented Jun 26, 2023

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"}}

@christophstrobl
Copy link
Member

@juzq thanks for reporting and the PR!

@christophstrobl christophstrobl added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 27, 2023
christophstrobl pushed a commit that referenced this issue Jun 28, 2023
…numeric values.

Prior to this fix a path that contains numeric values used as position parameters would have been stripped in a way that left out the last digit. This could lead to wrong path resolution if the incorrectly constructed property name accidentally matched an existing one.

Closes: #4426
Original Pull Request: #4427
christophstrobl pushed a commit that referenced this issue Jun 28, 2023
…numeric values.

Prior to this fix a path that contains numeric values used as position parameters would have been stripped in a way that left out the last digit. This could lead to wrong path resolution if the incorrectly constructed property name accidentally matched an existing one.

Closes: #4426
Original Pull Request: #4427
christophstrobl pushed a commit that referenced this issue Jun 28, 2023
…numeric values.

Prior to this fix a path that contains numeric values used as position parameters would have been stripped in a way that left out the last digit. This could lead to wrong path resolution if the incorrectly constructed property name accidentally matched an existing one.

Closes: #4426
Original Pull Request: #4427
@christophstrobl christophstrobl changed the title Bug: mapNestedIntegerFieldCorrectly test failed, when change the last integer to grater than 10 Update path not correctly mapped when last segment is multi digit number Jun 28, 2023
@christophstrobl christophstrobl added this to the 3.4.14 (2021.2.14) milestone Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants