0

In Firestore, I have documents that have fields that may or may not be null. If there are indeed holding a null value, I'd like to write on them. If not, I don't want to write to them.

Is there a way to do this without checking it before updating it?


Note: I am operating on Firebase Cloud Functions.

Xevion
  • 371
  • 3
  • 13

1 Answers1

0

Writing to a document requires that you know its full path. And the only way to know the full paths of the documents with the relevant value is to perform a query for those documents. So no, there's no way to update all documents that meet a specific condition without first querying for them, and thus incurring the read cost.

Also see:

Frank van Puffelen
  • 499,950
  • 69
  • 739
  • 734