Skip to content
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

Extended Reference Pattern with odmantic #496

Open
Spucis opened this issue Aug 11, 2024 · 0 comments
Open

Extended Reference Pattern with odmantic #496

Spucis opened this issue Aug 11, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@Spucis
Copy link

Spucis commented Aug 11, 2024

I wanted to implement the Extended Reference Pattern using odmantic, as explained in this mongodb article https://www.mongodb.com/blog/post/building-with-patterns-the-extended-reference-pattern.

I tought that the solution to my problem would have been the Referenced Model. As odmatic's documentations states in the modeling chapter "Another use case where references are useful is for one-to-one/one-to-many relations but when the referenced model has to exist in its own collection, in order to be accessed on its own without any parent model specified."

This seems to be the perfect use case scenario, but i noticed that Reference Model does not permit to retrieve any attribute from the referenced model, except from the objectId (or any primary key i'm guessing).

Am i correct? Or I am missing something?

If I'm correct, wouldn't be a nice feature to be able to use Referenced model to retrieve also other attribute other than the primary key? This will permit to implement the Extended Reference Pattern.

Probably i could user Embedded Models, but then i will lose the possibility to have the check that the Embedded model exist, am i right?

Thanks in advice!

@Spucis Spucis added the enhancement New feature or request label Aug 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant