Skip to content

Extend support around the Extended Reference Pattern via DocumentReferences. #4801

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
christophstrobl opened this issue Oct 2, 2024 · 1 comment
Labels
type: enhancement A general enhancement

Comments

@christophstrobl
Copy link
Member

Explore if it makes sense to have a different extraction pattern for storing the relation than for the retrieval. Doing so would allow users to build dedicated views on the data for reading operations that require less data and must not resolve the reference.

class Payment {

    String id;

    @DocumentReference(fields = { "id", "name", "birthdate" }, lookup="{ '_id' : ?#{#target.id} }")
    Customer sender;

    PaymentReceiver receiver;

    // ...
}
@christophstrobl christophstrobl added the type: enhancement A general enhancement label Oct 2, 2024
@jesmith17
Copy link

I was just thinking about this, and I think it's a very beneficial pattern to support, but I would probably do it via a dedicated annotation @ExtendedReference instead of @DocumentReference so that you don't confuse the 2.

From a data modeling perspective, you wouldn't want the behavior to flip where sometimes it's the full object and others it's the subset. So I see having the new annotation being a better fit here. I actually created a fork and was going to start working on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants