Skip to content Skip to sidebar Skip to footer

Firestore Update From Dictionary

I have a dictionary that contains a number of keys and values that should be applied to a document. Pseudocode to explain what I am trying to do: doc_ref.update({*[k: v for k,v in

Solution 1:

This is the solution I settled on.

batch = db.batch()
...
for k in dict:
    batch.update(doc_ref, {k: dict[k]}, firestore.CreateIfMissingOption(True))
batch.commit()

Post a Comment for "Firestore Update From Dictionary"