Hey there,
Currently I am struggeling with my partitioning strategy and maybe you can give me a hint how to improve it.
Basically my app is meant for bands to plan their gigs. So you as a User
can log in and you are assigned to one or more Bands
. Every Band
also can have one or more Events
. To simplify things I have made a litte schema to visualize my data-structure.
As you can see, I use a partition-key for my current user
and this user
has a list of bands
, where I can append and remove them. (This pattern is from the documentation in the Relations: Many-To-Many section).
From the bands
Object I can take the bandID
and pass it as a partition-key for all of the events each band has. This does somehow conform to the way team realms should be partitioned (based on the documentation).
- The big advantage is, that I only need the partition key for having all events loaded at once, for every band and member.
- But the disadvantage is, that I only can display events from one band at once, due to the limitation of only be able to use one partition key (or
bandID
) at once.
But I somehow need that behaviour in the app. When you are in for example two bands at once, the overview should show all events they are assigned to.
Things I tried/thought of so far to solve this:
Trying to use multiple partition-keys at once — I think this is not a very elegant solution for the problem, but I tried, haha
Appending the Events also to the Band as a List — this was the most valueable solution up until now, but I think there will be syncinc issues bc the events no longer will be a top-level object. Instead they’ll become a children of band and grandchildren of user.
Somehow use Realm Triggers — but there I have no clue in wich way they could help me, I just have seen them in different tutorials and articles like RChat.