Is is possible to restrict model objects for two different realms used on client


Lets say I have model object A, B, C, D, E and F and there are relationships between them

My synced user realm uses all six of the model objects, but a shared realm that all users have access to only uses C, D and E. All if fine if I create my Realm configuration for the shared data without any restrictions on object types. However, if I restrict the object types to [C,D,E], when I try to open the shared realm, I get a realm exception that A is not managed by the Realm, even thought it is not part of that Realm’s schema. Not sure if this is expected behaviour, but its a bit confusing.


I think I understand why this is causing me issues. Its the relations between the model objects. In particular references back via LinkingObjects that are causing me issues. The shared realm needs to have all the information in order to be valid.


@robowen5mac The way our query based sync works is if you subscribe to an object you by default will get all child objects that are linked off the parent object. I hope this helps but I’m not sure I am answering your question.


I think the problem here is that any models that are referenced in the types you want to restrict the Realm on must be in the restricted set of types. So for example, if C links to A, then you need to include A in the list of restricted types, otherwise Realm wouldn’t know what to do when you set or queried for it.


Yes I understand how things work better, thanks to you both.