realm.deleteAll() does not delete stale data
See original GitHub issueGoals
When I remove a model and update the schema, I would love to clean up the data as well.
Expected Results
realm.deleteAll() would remove all data, no matter if it is in the schema or not.
Actual Results
The data of the deleted model still persists.
Steps to Reproduce
If I had a Car model, but the new schema got rid of it. Even after I call realm.deleteAll(), the stale data from the old Car model still exists.
Code Sample
Version of Realm and Tooling
- Realm JS SDK Version: 1.3.1
- Node or React Native: react-native 0.44.0
- Which debugger for React Native: None
Right now I am deleting the .realm file before initializing to get rid of the stale data, but it seems to me that realm.deleteAll() should mean a clean slate with the new schema and without any stale data like this.
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Does Realm deleteAll() Reset Primary Keys - Stack Overflow
1 Answer 1 ... Realm.deleteAll() removes all objects stored in the Realm. The values of primary key properties must be unique amongst objects ......
Read more >CRUD - Delete - React Native SDK — Realm - MongoDB
To delete all objects from the realm, call Realm.deleteAll() inside of a write transaction. This clears the realm of all object instances but...
Read more >Why do I get an error when deleting data from SwiftUI List and ...
write is the Realm syntax to be able to perform changes to the database. I'm deleting results[0] when a button is tapped just...
Read more >Realm clear all data
By calling this method, all Realm files are deleted, which means all objects & schemas are gone. Catching all exceptions is a bad...
Read more >Delete index API | Elasticsearch Guide [8.5] | Elastic
Deleting an index deletes its documents, shards, and metadata. It does not delete related Kibana components, such as data views, visualizations, or dashboards....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Merged 532f517, which exposes a
deleteModelmethod to be used during migrations.Thank you! @ashwinphatak