Migrating from non-synced realm to MongoDB

My android app has not been updated for a couple of years and is still using a non-sync Realm V5.15.1. I would like to update it to the latest MongoDb version with sync capabilities for users. I also need to make changes to a lot of the classes and fields. What is the best way to update while making sure users retain their data?

I have been unable to find resources dealing with this scenario. Any advice, tips, links or guides will be greatly appreciated.

@Deji_Apps Non-sync realms and sync realms are of a different storage format so in order to migrate to using a sync realm you would need to open two realms in the app, the old non-sync realm and the new synced realm, and then copy the data out of the non-sync realm and insert it into the sync realm as new realm objects. From there you can then close and delete the old non-sync realm and just continue using the sync realm going forward. Sync realms behave just like non-sync realms in terms of APIs - querying, writing, and notifications are all the same so hopefully the real meat of your application code will not need to change.

The biggest difference is that you open a sync realm with a SyncConfiguration and need to login a user in order to sync data but most other APIs remain the same.

You can quickly compare the differences by looking at the non-sync realm quickstart -

And the sync realm quickstart -


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