Skip to content

Dedicated annotations to support Extended Reference Pattern #4984

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

Open
jesmith17 opened this issue May 26, 2025 · 1 comment
Open

Dedicated annotations to support Extended Reference Pattern #4984

jesmith17 opened this issue May 26, 2025 · 1 comment
Labels
status: waiting-for-triage An issue we've not yet triaged

Comments

@jesmith17
Copy link

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 @Id or _id of the child object should always be included in the embedded fields
  • Only fields annotated with @ExtendedAttribute or with @Id or @MongoId should 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.
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 26, 2025
@christophstrobl
Copy link
Member

Related to: #4801

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

No branches or pull requests

3 participants