Replies: 1 comment
-
|
I think there is a join field for that |
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
Uh oh!
There was an error while loading. Please reload this page.
-
Hey everyone,
been trying out Payload CMS for the last few days, looking good so far. However, I'm not sure how to approach this requirement I have. Disclaimer: the issue might just be that I'm more used to relational DBs.
Let's say we have 3 models:
The requirement: whenever I query a
Userdocument (whether I query by ID or the entire collection), I would also like to include anordersproperty, which is an array of references to the orders that the queriedUseris part of.Possible solutions that come to mind right now:
afterReadin theUserconfig - causes an infinite loop when querying theOrdercollection unless you usedepth: 0inpayload.find()ordersproperty to User and manually updating it whenever theuser_idproperty changes on anyOrderdocumentAm I missing an obvious solution here?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions