Migrating a local realm to the cloud

Hi -

I am new here so thanks in advance. Apologies if this is the wrong forum.

I have an app that uses a simple one file realm db (lets call it X.db). Currently, the file X.db is part of the app. Its kind of a reference app so the db doesn’t change often. But it does change - a little. I’d like to be able to centrally change it and have it reflected when the users run the app.

So I’d like to move the db to the cloud. How do I do that? What changes would my app need? I know there may be various ways with different pros and cons. I don’t think I need anything complicated (like a MongoDB Cluster). I think I just want a hosted realm.

Thanks again in advance,

It sounds like you have a local Realm for your app and you want to convert your app to storing Realm in the cloud as well. Cool.

In a nutshell, you will need to add the code to your app to connect to the Realm cloud (aka Realm Sync). Your models will need to be updated with a couple of properties; a Partition Key and the primary key. There are a few other bits you’ll need to implement such as user or users and then handling async errors.

I am not sure what your coding platform is but there’s an excellent guide of how to do most (all?) of that. Here’s the Swift version and there are versions for a variety of other platforms

1 Like

Thank you. I’ll take a look at what you sent. Platform is Swift.