Docs really need an update. Besides the super-trivial examples, there are no architecture examples for real-world apps using the best practices suggested. Docs are incredibly frustrating littered with:
Query-based Sync is not recommended. For applications using Realm Sync, we recommend Full Sync. Learn more about our plans for the future of Realm Sync here.
Yet the majority of examples demo query-based sync.
Docs continuously tout
Offline-First yet all sync examples require logging in to the cloud first.
Docs recommend using Full Sync:
For example, a common pattern is to use a global Realm for shared data at a base path /globalRealm and put user-specific data in an individual Realm at each user's scoped path: /~/myRealm
Yet don’t see any examples on implementation of this.
Really is frustrating trying to follow these suggestions without further elaboration.
From what I am able to gather:
- Common shared data that needs to sync to all users should share a common realm like
globalRealmand sync to all users
- User-specific data should live in their own realms:
/~/myRealmwhich only syncs to the relevant user.
If we take the car example in the docs, we saying the
Car schema should exist in the global realm so that models like ford and honda sync to all users. This car data is also needed in the user’s specific realm though as User.cars schema links to Car schema. So how is global car data kept in sync with the car data in the user’s realm? I assume this requires a sync from globalRealm to the users realm?
If we suggesting
Offline-First then I assume we using realm database first and syncing only when we oline - but where is the example of that flow? All examples require cloud login first and not clear how the local realm database integrates?
Seems like a decent product and I have elementary sync working between cloud, react native and node apps - but the real-work architecture suggested is elusive.