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

Id conversion handling in QueryMapper.getMappedValue(…) doesn't consider nesting #4707

Closed
antechrestos opened this issue May 27, 2024 · 1 comment
Assignees
Labels
type: regression A regression from a previous release

Comments

@antechrestos
Copy link

While upgrading to springboot 3.3.0, I detect a strange behaviour.

I use spring-boot-starter-data-mongodb-reactive with CoroutineCrudRepository.

When using coposite id, I cannot save documents. Every save ends with error

Write operation error on server localhost:32811. Write error: WriteError{code=66, message='After applying the update, the (immutable) field '_id' was found to have been altered to _id: { user: { _id: "1", tenant: "tenant" }, demoId: "demo-id", timestamp: new Date(1716798131072) }', details={}}.

I made a demo repository

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 27, 2024
@antechrestos antechrestos changed the title Failed to save composite id on 4.3.0 version SB 3.3.0 Upgrade - Failed to save composite id on spring data mongo 4.3.0 version May 27, 2024
@mp911de mp911de changed the title SB 3.3.0 Upgrade - Failed to save composite id on spring data mongo 4.3.0 version Id conversion handling in QueryMapper.getMappedValue(…) doesn't consider nesting May 28, 2024
@mp911de mp911de added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels May 28, 2024
@mp911de
Copy link
Member

mp911de commented May 28, 2024

convertIdField(…) applies structures and types of the Id field even for nested documents if the Id is a document with nested documents. We have to fix that.

@mp911de mp911de added type: regression A regression from a previous release and removed type: bug A general bug labels May 28, 2024
@mp911de mp911de added this to the 4.3.1 (2024.0.1) milestone Jun 12, 2024
mp911de added a commit that referenced this issue Jun 12, 2024
Avoid duplicate query mapping for document replacement operations when the filter query can be determined from the already mapped _id field.

See #4707
Original pull request: #4719
mp911de pushed a commit that referenced this issue Jun 12, 2024
This commit fixes an issue where the property type for nested fields of an complex id is not handed over correctly leading to wrong conversion results eg. for Instant types that got then turned into ObjectIds.

Closes #4707
Original pull request: #4719
mp911de added a commit that referenced this issue Jun 12, 2024
Avoid duplicate query mapping for document replacement operations when the filter query can be determined from the already mapped _id field.

See #4707
Original pull request: #4719
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: regression A regression from a previous release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants