-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
I have a case where I'm calling a copyToRealmOrUpdate(List) and I have noticed that the RealmList that is a property on MyObject gets updated to the new list for MyObject but old objects get orphaned and not deleted. My guess is that there is no support for cascading deletes. Since they don't have primary keys, I have no identifiable way to query them and remove them after the fact.
What would be the best possible solution for this? Would MyObject's property need to also have MyObject's primary key in order to query and delete those old orphaned objects? I could try some sort of app processing to remove them before the copyToRealmOrUpdate but it seems really heavy and only grows as the number of MyObjects grows.
Get a List
For each MyObject, query for the stored Realm MyObject.
Get RealmList from stored Realm MyObject
Loop through RealmList object and removeFromRealm
Thoughts?