Add back populating for document #515
ErezAmihud
started this conversation in
Feature Request
Replies: 1 comment
-
Hi, https://github.com/roman-right/beanie/tree/feat/back-refs https://github.com/roman-right/beanie/blob/feat/back-refs/tests/odm/test_relations.py#L458 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In mongodb and other document based dbs one to many relationship presents itself as an additional attribute in the "many" part of the relationship.
For example, describing a user and a post relationship can look like:
When using this program, I might want to get all the posts a user has created, so I would like to have something like:
When using it, the user posts attribute would not be saved in the user document but loaded from query all posts where
Post.user
if the current user.tl;dr same as relationship(back_populates) in sqlalchemy, or even better, read this section about populating virtuals in mongoose
Beta Was this translation helpful? Give feedback.
All reactions