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 relationship is not queried correctly #586
Comments
Any solution to this may depend on whether or not you are using the RTDB adapter or the firestore adapter, although I suspect for many to many relationships its the same issue. for the firestore adapter it appears to me that many to many is not explicitly handled and in your case above
My plan, which seems to work reasonably well so far (early days), is to create an additional 'join table' collection and work through that i.e a collection called
then, in my models I have Interested to hear what others are doing... |
many-many is not supported with the current design |
I have adjusted the findHasMany class in the adapter for firestore, and I created my own relationship option of ManytoMany. Seems to work for me. emberfire/addon/adapters/firestore.js
and in my model i would have...
downside obviously is saving references in each model. |
I have 2 models with a many-to-many relationship.
models/club
models/member
First I make some example data. I create a
club
, save it, create amember
, save it, and finally updateclub.members
with the savedmember
and save theclub
again.This yields the following in Firebase:
Everything is working fine at this point. However, when I go to find the created
club
and read itsmembers
property, the result is always an empty array.I would expect to see an array of
member
objects after that second promise fulfillment. What I am doing wrong?The text was updated successfully, but these errors were encountered: