0

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);
      });
  }
1
  • 1. Thank you for the answer. I Think what you said is true, they just simply return true , if they can delete, or the document isn't on the collection. But you know, sometimes, we need that :) Thanks for the answer bro Commented Jul 5, 2018 at 23:10

1 Answer 1

2

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).

Sign up to request clarification or add additional context in comments.

2 Comments

so, ur sayin it's not a bug?
@RonRoyston Realtime Database works the same way, so I'm going to say it's not a bug.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.