Basically, my schema contains users, who have recipes.
Recipes have authors, denoted by a string id.
So, I’m partitioning synch on the author field.
Now I want users to be able to share their recipes with friends.
Here’s how I have it setup so far.
A little confusing, but it works in some ways.
Users have a watchedRecipes key in customData, which is an array of recipe id’s. When an author shares a recipe with another user, the recipe id is added to the recipient’s watchedRecipes array.
This actually works great from the web side. When I query for recipes to show on the users’s homescreen, I just augment the query to include recipes with id’s in the watchedRecipes list. And I adjust the UI to show the difference.
But I don’t know how to approach finding these recipes on my mobile apps.
Considering that these watchedRecipes do not maintain the user id as their author, they don’t conform to my partition. Is there a straightforward way to query for the id’s in the customData? Or do I need to think about creating a new real with a different partition?
Note: In the future, I’m planning to do this for a chat feature. I plan to create a new realm, and partition on a field containing combinations of user id’s. But I’d prefer to keep this mess cleanly divided from the recipe list code.