spring-projects / spring-projects/spring-data-mongodb
Dedicated annotations to support Extended Reference Pattern
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.7k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
The Extended Reference data modeling pattern in MongoDB is one of the most popular and most powerful, but it's difficult to implement in Spring due to lack of support.
Im recommending creating two new annotations @ExtendedReference and @ExtendedAttribute to support this.
@ExtendedReference would be applied to a embedded object and used to identify that
- The object needed to be persisted as an embedded document to the parent
- The
@Idor_idof the child object should always be included in the embedded fields - Only fields annotated with
@ExtendedAttributeor with@Idor@MongoIdshould be persisted.
Fields with the @ExtendedReference annotation should never be retrieved via $lookup but if needed could be explicitly retrieved and set into the parent object.
This would allow users to take advantage of the extended reference pattern without
- Creating new custom POJO's to represent the smaller version of the class
- Having to do extensive custom serialization work
- Impact any of the existing query operations in the spring-data library.
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.
Research direction
The issue names no files, tests, or entry points. Start by mapping existing annotation and MongoDB persistence behavior, then clarify how embedded fields, identifiers, explicit retrieval, and query compatibility should be tested; done requires an agreed design and coverage for the proposed annotations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, mongodb, spring
- Domain
- backend, database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100