I’m struggling to understand a couple things about partitions and Realm Sync.
I’m currently in Development Mode. I’ve create some data using the _partition key with the value of “PUBLIC” which should be accessible by all users. Additionally I’ve created some private data using the _partition key with the user’s ID string.
-
In order for the user to sync both their private and PUBLIC data, do I need to “asyncOpen” both Realms with the _partition key set to “user.id” and “PUBLIC” respectively?
-
My private data contains links, or lists of PUBLIC data. If I try the above (with two realms) when I try to write private data which references the PUBLIC data I get the following error: ‘Object is already managed by another Realm. Use create instead to copy it into this Realm.’
-
Since I’m in Development Mode my expectation is that none of this should be happening right now. All data in my DB should be sync with my user, regardless of what the partition key value is under a single Realm connection instance.
-
Also in Development mode, I would expect that I could write new data to my DB using the same Realm connection instance, but using different values for the _partition key. For example, perhaps my user would like to write PUBLIC data, they should be able to do that under the Realm instance that was opened with the partition key being their user.id, no?
Fundamentally, my hope is that I can open a single Realm instance on the client, using the _partition key of my user and sync both the user’s private and all the PUBLIC data in the Realm. At least this is what I gather is possible from the documentation.
Can someone help me understand what I’m missing and if the above is possible?