You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a join table to create a many-to-many relationship, when I get the data from one side of the table or the other, the objects returned in the array are the join table objects, not the objects on the other side of the table. Is this normal or expected? It seems to be an odd behavior especially if I'm wanting to nest the data properly. Here's my example
I'm actually trying to create a many-to-many-to-many type of nested situation, but that's a different question. First, I need to solve the first join table issue. Now, when I query the even just the ModifierCategory model like such
Again, if this was the expected behavior, I'll close this, but it makes nested data that are separated models a bit difficult with many-to-many relationships.
Expected behavior
I expected to see the actual types nested under the types array of the query rather than the objects of the join table.
Reproduction steps
Create two models with a many-to-many relationship and use a join table to connect the relationships. Then query one side or the other as nested.
Code Snippet
// Put your code below this line.
Log output
// Put your logs below this line
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered:
Hi @chrisbonifacio thanks for the feedback! Can we add to that feature request to also allow a many-to-many-to-many or ternary type of join table? Or at least have a solution/example of how that should be done?
Using the models above it would be something like:
Categories have access to types, but not all categories can access all types
Types have access to methods and many methods are shared across the types.
Categories only have access to the methods within their allowed types, but they don't necessarily have access to all the methods of that type
Originally I had a join table for categories to types and then used the id from that object to map to a categoryType to method but because of the way the join data comes out, it didn't work.
Before opening, please confirm:
JavaScript Framework
React
Amplify APIs
Not applicable
Amplify Version
v6
Amplify Categories
api
Backend
Amplify Gen 2 (Preview)
Environment information
Describe the bug
When using a join table to create a many-to-many relationship, when I get the data from one side of the table or the other, the objects returned in the array are the join table objects, not the objects on the other side of the table. Is this normal or expected? It seems to be an odd behavior especially if I'm wanting to nest the data properly. Here's my example
I'm actually trying to create a many-to-many-to-many type of nested situation, but that's a different question. First, I need to solve the first join table issue. Now, when I query the even just the ModifierCategory model like such
I get back an array of objects that are the join table objects, not the types from the ModifierTypes data table. However, if I query like this
I see the type objects, but they're nested under the objects under the types array like this
Again, if this was the expected behavior, I'll close this, but it makes nested data that are separated models a bit difficult with many-to-many relationships.
Expected behavior
I expected to see the actual types nested under the types array of the query rather than the objects of the join table.
Reproduction steps
Create two models with a many-to-many relationship and use a join table to connect the relationships. Then query one side or the other as nested.
Code Snippet
// Put your code below this line.
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: