Missing feature: delete by id
See original GitHub issueI’m using Realm and I really miss the feature of deleting objects using thier Ids, the way we’ve right now is:
realm.write(() => {
// Create a book object
let book = realm.create('Book', {id: 1, title: 'Recipes', price: 35});
// Delete the book
realm.delete(book);
// Delete multiple books by passing in a `Results`, `List`,
// or JavaScript `Array`
let allBooks = realm.objects('Book');
realm.delete(allBooks); // Deletes all books
});
But I see that it’d be handy to delete by just passing the id:
realm.write(() => {
// Create a book object
let book = realm.create('Book', {id: 1, title: 'Recipes', price: 35});
// Get the book id
let bookId = book.id;
// Delete the book
realm.delete('Book', bookId);
// or
realm.delete(bookId);
});
Issue Analytics
- State:
- Created 6 years ago
- Reactions:9
- Comments:11 (4 by maintainers)
Top Results From Across the Web
how to delete all the missing feature and set up files reported ...
Hi Krishna,. You can use PowerShell code to remove the missing features. There is a similar blog, you can refer to it:.
Read more >2016 - Cannot find MissingFeature to remove it from a Content ...
However the only place I can find a reference to this Feature Id is in the database itself under the FeatureTracking table. I...
Read more >Delete Missing Features – dig deeper - soumyabhatta
I have been tasked with deleting missing features from existing farm. ... Parameter name: Could not find Feature Your Feature Id.”
Read more >How to remove orphaned (missing) SharePoint Features with ...
Running the Script above will remove all of the missing Features from all of the Site Collections as well as each Sub Site....
Read more >Remove Missing Features From Content Database - C# Corner
The feature with Id xxx-xxxxxx-xxxxxx-xxxxx is referenced in the database [SharePoint_Content_Portal], but is not installed on the current ...
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 FreeTop 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
Top GitHub Comments
Right now the easiest way to do this:
Excellent @alazier your solution has been worked @lossen Could you please this
` realm.write( () => {
realm.delete(realm.objectForPrimaryKey(‘Book’, bookId));
})
`