How do you update sub-document in cosmos db

Jerrod Horton picture Jerrod Horton · May 9, 2018 · Viewed 7k times · Source

I am new to Cosmos Db and want to understand how to delete/upsert sub-documents within a document collection.

If i have a document:

{ "Id": "1234", "Name": "foo", "Items": [ { "Id": "abcd", "Age": 35, "Claims": [ { "Name": "email", "Value": "[email protected]" } ] } ] }

How do i:

1) add an item to the Items list in the document.

2) delete the existing Item from the Items list

3) upsert item to the items list in the document

4) add/delete a claim value to existing item in items list?

Thanks in advance.

Answer

Sajeetharan picture Sajeetharan · May 9, 2018

Currently there is no way rather than retrieving the document doing the modification and updating it.

However there is a User voice feature request has been updated on Mar 5, 2018: