I’m looking to take advantage of MongoDB Realm’s offline feature, but I am also considering using GraphQL and Functions to simplify client communications with the database. Can calls to the GraphQL API and to Functions be done to the offline instance of the database managed by MongoDB Realm? Or does using these features require internet connection?
They cannot at the moment, all calls via the GraphQL API or functions are essentially REST API calls that need connectivity and are suggested for Web App use-cases
Ok thanks! So could I, for instance, use the GraphQL API when online, and only interact with the local Realm instance when offline?
That should be possible, though Realm Sync handles both the online/offline case when you’re querying. Is there a reason you’re leaning towards splitting the logic?
Sure, the main reason I was thinking about splitting the logic is that, although we are currently only developing an iOS app, at some future point we will likely develop an Android app too. So I thought it would be smart to factor out the specifics of the database interactions into a MongoDB Function or a custom GraphQL query so that this code could be shared between the different apps. There isn’t very much offline functionality we need for the app, so I am now thinking it might make sense to use MongoDB Functions or GraphQL for most interactions, and only Realm Sync when needed for offline functionality.
Do you think that makes sense? Or would there be a better way to abstract away the database interactions code to be used by both an iOS and Android app, while still allowing offline functionality?
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.