How are multiple partitions handled in React Native Realm?

Hi,

If I have two sets of data with two different partition keys, can I return both sets of data in the same realm? Or do I have to open two different realms, passing in a different partition key for both realms?

For example, one set of data should be available to all users, so I’ll specify a partitionValue of “PUBLIC” in the realm config to open a new synced realm. The other set of data is user specific, so I’ll specify a partitionValue of “userId=123” in the realm config to open a new synced realm. Since these are two different partitionValues, do I have to open two separate realms? Or is there a more seamless way to acquire all the data partitioned as “PUBLIC” and acquire all the data that’s user specific and partitioned as “userId=123” in one realm?

Also, if the only way is to open multiple realms, can multiple realms be opened with Promise.all? Or do they have to be opened sequentially?

Thanks!

You would need to open two separate realms by supplying each with a separate partitionKey value. You should be able to open them both at the same time.

1 Like

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