Reputation: 245
I want to use Realm and I need to write data from different threads. I read post about Realm. Realm is similar as Git. Can you explain how merge of data with conflicts works in Realm? Thanks
Upvotes: 0
Views: 288
Reputation: 81588
Can you explain how merge of data with conflicts works in Realm?
If we are talking about the Realm local database (Realm Mobile Database), and NOT about the Realm Mobile Platform:
If we are talking about the Realm Mobile Platform:
When multiple offline transactions occur on the same data where they only get synced later, the conflict resolution happens based on rules of the operational transform:
Deletes always win: If one side deletes an object it will always stay deleted, even if the other side has made changes to it later on.
Last update wins. If two sides update the same property, the value will end up as the last updated.
Inserts in lists are ordered by time. If two items are inserted at the same position, the item that was inserted first will end up before the other item.
Upvotes: 1