Search code examples
xamarin.formsrealmrealm-mobile-platform

Sync two identical data records from two different devices with realm


if I have two devices, during the time of losing network connection, both devices added the same data record to their local realms. When network becomes available again, what will be the result of sync? If the data record has primary key, will it crash the sync transition? If the data record does not have primary key, how can I remove the same data? Thanks.


Solution

  • If the object has a primary key, then the two records will be merged into a single object. If it doesn't have primary key, it will result in two records being added and you will need to find some other criteria to determine they are the same object and merge them manually, either on the client or on the server.