spring-projects / spring-projects/spring-data-mongodb
Should MappingMongoConverter#read really require to call getCollection of MongoPersistentEntity?
@christophstrobl is already working on this.
Since Dec 6, 2021.
- Dominant language
- Java
- Stars
- 1.7k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
Hi, we want to upgrade from spring boot 2.5.x to version 2.6.x. In the new version of SB, the spring data mongo db was updated from version 3.2.x to 3.3.x.
In our code base, we often use MappingMongoConverter provided by MongoTemplate and try to deserialize a document (bson object) to Java entity (using MappingMongoConverter#read(Class<S> clazz, Bson bson)).
In version 3.3 of spring data mongodb, you added method #findContextualEntity, which requires retrieving the collection name from the MongoPersistentEntity.
I think the need to know the name of the collection is too strict and within the simple deserialization of the bson object, this should not happen.
Can you please consider this condition or possibly explain to me why this is needed even within the simple deserialization of any bson object?
To be more clear, I am talking about the implementation of private method with signature
private <S> S read(ConversionContext context, MongoPersistentEntity<S> entity, Document bson), which calls the stated findContextualEntity method.
Thanks you for your reconsideration and reply.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.