-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Many to many relationships #8
Comments
It might be a bit unclear, but "one" and "inverse" are actually many-to-one (with "one", a parent can only have one child, but many parents could have the same child). "many" and "many-inverse" are many-to-many. Which one to use depends on if you're storing the _ids on the children or the parents. There are 5 update hooks: parent.insert, parent.update, child.insert, child.update and child.remove Basically you should always be able to rely on the caches being updated no matter what you do. If they're not, that should be considered a bug. Caches are updated immediately and synchronously, so you could do: Posts.insert({_id:'post1', authorId:'user1'})
Posts.findOne('post1').author //will contain the cached user There is one exception: the cacheField() update is always deferred, to work properly with "recursive caching" |
Hey Simon, I'm struggling to get this working, I might be missing something. This is my code. What am I doing wrong?
|
Since the referenceField is "appointmentId", I'm guessing this is actually an "inverse" relationship? |
Yeah, that worked. Thanks.
…On Fri, Sep 8, 2017 at 11:57 PM, Simon Herteby ***@***.***> wrote:
Since the referenceField is "appointmentId", I'm guessing this is actually
an "inverse" relationship?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#8 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACTfwVaVGxv2SgE_mfyCALcpcB6fBH5Dks5sgUfTgaJpZM4POBrb>
.
--
Thanks,
*Chathura Ambegoda.*
|
Hi Simon,
What is the best way to have many to many relationships? at which point does this cache the doc, on insert?
Thanks,
Chat.
The text was updated successfully, but these errors were encountered: