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
Hi! I'm not so familiar with WatermelonDB, so, I'm asking for help.
Imagine we have many-to-many relation between two tables: Docs and Tags. It means each doc could be tagged by any number of tags, and each tag could be assigned to any number of document.
We have a screen (React-Native) where docs and it's tags should be displayed. Say, it is a list of docs with a list of small color tags.
What is the best way to achive reactive updates (when tags or docs or their junction updated) in such a schema?
I developed a schema of 3 tables:
Docs,
pivot table of Doc_Tag (mapping of keys (docId; tagId)),
Tags.
I tried to use an SQL view, but looks like WatermelonDB doesn't support such a feature.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! I'm not so familiar with WatermelonDB, so, I'm asking for help.
Imagine we have many-to-many relation between two tables: Docs and Tags. It means each doc could be tagged by any number of tags, and each tag could be assigned to any number of document.
We have a screen (React-Native) where docs and it's tags should be displayed. Say, it is a list of docs with a list of small color tags.
What is the best way to achive reactive updates (when tags or docs or their junction updated) in such a schema?
I developed a schema of 3 tables:
I tried to use an SQL view, but looks like WatermelonDB doesn't support such a feature.
Then I found this doc: https://watermelondb.dev/docs/Relation#many-to-many-relation. But it looks a bit frustrating.
I want to have an observable for each of tables to make a proper update on the UI.
Beta Was this translation helpful? Give feedback.
All reactions