From the blow post below
Firebase client-side fan-out for data consistency
Multi-path updates sound awesome. Does that work the same for Multi-path deletes?
Use case: I add a new post and it is fanned-out to many many followers. I decide to delete the post later on. Does the delete work the same? Do you have an example?
You can delete many posts in a single operation, by setting the value for each key to null.
function deletePostFromFollowers(postId, followers) {
var updates = {};
followers.forEach(function(followerId) {
updates['/users/'+followerId+'/posts/+'postId] = null
});
ref.update(updates);
}
deletePostFromFollowers('-K18713678adads', ['uid1', 'uid2']);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With