PUT workaround for Firestore

Hello,

I want to add data to my firestore array

.json:

from data that is in appgyver:

I appreciate any help on this since PATCH is overwriting the data and PUT is not working.

P.s. I don’t want to create a subcollection in Firestore.

Thanks for your help!

There are two approaches I am using for it:

a)

b)

  • to change only a certain value in a document, it is possible to use “mask” in the http-request:
  • url: URL_OF_DOCUMENT + ?updateMask.fieldPaths=KEY_TO_CHANGE
  • body: json that fits the KEY_TO_CHANGE starting with {“fields”:{…

Looking at your screenshots: it seems that you want to add an item to an arrayValue. Both approaches described above will overwrite the arrayValue with a new arrayValue. That means to add an item, you will need to download the old array, add the item to it, and finally upload the modified array.

Thank you. All clear on the concept.

Can you show me an example how you implemented this? It doesn’t need to be an array if you don’t have it handy.

I’m struggling to create an “updated” variable in appgyver that is in a workable format to be patched for Firestore.

Thanks a lot!!