Reputation: 2515
How can Realm handle deletes so that it can maintain the correct number of objects? i.e delete realm objects that no longer exist from the main data source.
lets pretend we have a User
and property is just name
database
On initial load, all these users are loaded into Realm
Now i decide to delete User:jim from the database
database
Realm still has reference to User:jim
Now I can easily clear the User table in Realm and then just do a re-insert. However this is not the ideal solution if you have thousands of Users.
Is there some way to easily query the new collection with that of Realm and just remove the User that is no longer present?
Upvotes: 0
Views: 90
Reputation: 20126
No, that kind of negative search is not possible, and I doubt you can do better than O(n*m) in any case. If you add indexes it will speed it up but it still scales just as bad.
Depending on how your data is structured, it might be easier to just delete all users and add them again?
Upvotes: 0