this post was submitted on 11 May 2024
32 points (94.4% liked)
Programming
17303 readers
53 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities [email protected]
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
That's a good point!
The JSON version of this is to store an array of relation objects which express the weights.
In my opinion the main advantage of a “join table” in your situation is the ability to look up the relationship from either direction while only storing a single copy of it.
If you store the relation in the object, becomes very easy for A’s relation to B to get out of sync from B’s relation to A.
The other related advantage is being able to update data about a given B once, instead of everywhere it occurs as a child in A.