0

I'm looking for a way to add/remove data from an ArrayValue field, via the Firestore REST API.

I'm able to send the following PATCH request, to set all values of an array fields in a document, via the following:

Request Url

/v1beta1/projects/MY_APP/databases/(default)/documents/MY_COLLECTION/MY_DOCUMENT_ID?updateMask.fieldPaths=document_array&key=MY_KEY

Request Body

{
    "fields" : {
        "document_array" : { 
            "arrayValue" : { 
                "values" : [
                    { "stringValue" : "item_value_0" }, 
                    { "stringValue" : "item_value_1" }
                ]
            }
        }
    }
}

As expected, the document with id MY_DOCUMENT_ID in collection MY_COLLECTION updates so that the document_array field is populated with strings:

['item_value_0', 'item_value_1'].

Using the REST APIs PATCH method, I would like to add/remove/update/manipulate ArrayValue fields in my document MY_DOCUMENT_ID (ie as outlined in this question).

Is this possible? If so, how?

Thanks in advance

Dacre Denny
  • 29,664
  • 5
  • 45
  • 65

1 Answers1

1

It's not possible today. You could file a feature request stating what you want (it's been asked before).

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441