Realm syncing collections with different partition keys

Is it possible to make relationship b/w two collections which have different partition keys.If Yes how?

What should be the approach if I want to sync two collections with different partition keys.

  1. _partition_key : ‘catalog_id=someid’
  2. _partition_key : ‘PUBLIC’
    Should I open two different instance of realm or how?

Cross posting the reply from the Github issue:

Each partition value will end up in a different Realm instance. Any relationships that you set up between the collections that fall into different Realm instances will be null locally. If your app needs to keep references between different partitions, then you should not setup relationships and instead use the _ids of the objects and look them up manually. Be aware though that Realm will not impose any referential guarantees there, so it’ll always be possible to end up in a situation where an object from Realm 1 points to an id that is supposed to exist in Realm 2, but doesn’t.

You can read up on how partitioning works in the docs: https://docs.mongodb.com/realm/sync/partitioning/.

1 Like

@nirinchev one more question: What is the correct way to sync data in local instance of realm in electron js

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.