Zenko
Zenko

Reputation: 2569

Does FieldValue.delete() returns an exception if the field does not exist?

I have an existing data collection that now we need to add a new field as a flag called wasImageUpdate

Most of the documents does not have this field and we wanna keep it that way. So we only write that field whenever it needs to be true otherwise we want to remove it.

Since we will encounter documents that does not have that field, so doesFieldValue.delete() returns an Exception if the field does not exist or just do nothing?

Well, I can always check prior to setting it but it might just reduce a line of code and a document read count..

thanks

Upvotes: 3

Views: 633

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317712

It will not generate an error. If you observe something different, then file a bug with Firebase support.

Upvotes: 7

Related Questions