spring-projects / spring-projects/spring-data-mongodb

MappingMongoConverter#writePropertyInternal should prefer custom converters before simple type conversion.

Open
#4,122 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
1.7k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

org.springframework.data.mongodb.core.convert.MappingMongoConverter#writePropertyInternal(Object, DocumentAccessor, MongoPersistentProperty) appears to prefer serializing as a collection/map before checking if there are custom converters.

This is different than MappingMongoConverter#writeInternal(Object, Bson, TypeInformation), where the custom target is honored first. Is this by design? What is the reasoning for treating properties any differently than the objects themselves?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with MappingMongoConverter#writePropertyInternal(Object, DocumentAccessor, MongoPersistentProperty) and compare its conversion order with MappingMongoConverter#writeInternal(Object, Bson, TypeInformation). Determine whether the differing custom-converter precedence is intentional; done means the expected behavior and its rationale are established, with any required alignment identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, mongodb
Domain
database
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.