Open MerzoukeMansouri opened 7 months ago
@MerzoukeMansouri thank you for getting in touch! Would you mind adding a (failing) junit test to the reproducer? Thank you!
@MerzoukeMansouri thank you for getting in touch! Would you mind adding a (failing) junit test to the reproducer? Thank you!
Here you are, feel free to ask me any improvements.
Thanks.
thank you @MerzoukeMansouri - I do see the error now. Need to dig a bit deeper as it seems the _class
type hint is not being recognized when reading back the type within the set.
The issue seems to have been resolved in the meantime. The mapping does the expected from boot:3.2.4
(data-mongo:4.2.4) onwards.
I encountered an issue while working with Spring Data MongoDB latest version, where nested JSON objects within a generic class are not being handled correctly. Specifically, when attempting to interact with nested JSON structures using Spring Data MongoDB repositories, the behavior does not align with expectations.
Here a repository to reproduce.
Potential bug discovered
When attempting to load a complex structure involving generic classes and nested JSON within a Spring Data MongoDB document, the document fails to load correctly. Despite following standard procedures for data retrieval, the loaded document exhibits inconsistencies, particularly regarding the handling of nested JSON structures.
It's observed that the order of attributes in the entity class has a peculiar effect on the loading process. Specifically, the first generic item within the entity seems to be handled correctly, while the subsequent ones are not processed as expected. This behavior is unexpected and indicates a potential issue with the loading mechanism.
Upon inspection, it becomes evident that the first generic class is loaded correctly, whereas the second one fails to be properly processed during the document loading procedure. This inconsistency in handling generic classes within the document poses a significant hurdle, leading to data integrity concerns and unpredictable behavior.
Set to reproduce demo repository
Expected Behavior: The saved MyEntity instances should be retrieved from the database without any errors or data loss. Both attribute1 and attribute2 should contain their respective nested JSON structures (Structure1 and Structure2).
Actual Behavior: Upon loading the MyEntity instances, potential issues may arise where the nested JSON structures within attribute1 and attribute2 are not correctly parsed or mapped, leading to unexpected behavior or data inconsistency.