Reputation: 46
Some Strange thing is hapenning ..
I Am trying to delete document from firebase, the problem is even when the ID, isn't found on the collection It gives me back , a successfull msg.
is it a bug on firebase ???
DeleteOrganization(id) {
return this.afs.collection('organizations').doc(id).delete()
.then( () => {
console.log('Document successfully deleted!');
}).catch( (error) => {
console.error('Error removing document: ', error);
});
}
Upvotes: 0
Views: 1752
Reputation: 317868
The delete method gives you confirmation that a document doesn't exist. The document doesn't have to exist ahead of time.
If you need to ensure that a document exists before you delete it, you should check for that yourself, though I don't think you have anything to gain from that (it is just extra work for the same end result).
Upvotes: 2