0

I have a collections called 'users' and I want to add new field called 'status: boolean' to already exists every documents using cloud functions and firestore database instantly.

Fortray
  • 133
  • 1
  • 1
  • 8
  • To update a document, you'll need to know its exact path. That means you'll need to update each document separate, and need to read the document (or at least its ID) before you can write it. See https://stackoverflow.com/a/48950404 – Frank van Puffelen Sep 21 '19 at 06:36

1 Answers1

1

There is no bulk update operation, so you will have to:

  1. Query the collection for all documents
  2. Iterate each one
  3. Update the document with the new field
Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441