Updating Realm Sync Schema cuts client's connection

My issue concerns Realm Sync on iOS - SDK v10.20.0 on a free cluster M0 (which is my dev env, my prod env is on a premium tier).

When I update the server’s schema by adding a new field or a new collection, I have noticed an undocumented behavior :

  • Any mobile users with an opened Realm during the schema update don’t sync anything afterwards. A restart of the app is needed.

I have tried to do this schema update using the “Enter Dev sync mode” and by using Realm Dashboard “Data Access > Rules > Add new collection”.

  1. Is this lost-sync behavior normal?
  2. What’s the right way to update the Realm Sync rule schema?

Hi @Jerome_Pasquier – have you taken a look at this article… Migrating Your iOS App's Synced Realm Schema in Production | MongoDB ?

If that doesn’t fix things in, could you provide a before and after schema / Object definition that triggers this, and I’ll try to reproduce it.

Best Regards, Andrew.

1 Like

Thank you @Andrew_Morgan, I didn’t know there was such an article. The destructive part is very interesting.

However, my concern is related to additive changes. According to your article, additive changes should not pause or stop the current users from syncing.

What I have realized is that it does it.

I have added a field to a document while having my device connected to Realm Sync - the same way as your article. Then I do save new values on the device, I check the cloud DB with MongoCompass => The changes are not synced.

I have to wait for 2-3 minutes to see the changes finally on the cloud (or restart the client that will create a new connection).

I have cross-posted this question on Github Upon updating Realm Sync rules/schema, mobile clients don't sync anymore · Issue #7580 · realm/realm-swift · GitHub and apparently someone observe the same behaviour on their end.

I didn’t try calling a Realm function during this “down time” yet, so I don’t know if this will work.