Can I write an UPDATE
statement for Azure Cosmos DB? The SQL API supports queries, but what about updates?
In particular, I am looking to update documents without having to retrieve the whole document. I have the ID for the document and I know the exact path I want to update within the document. For example, say that my document is
{
"id": "9e576f8b-146f-4e7f-a68f-14ef816e0e50",
"name": "Fido",
"weight": 35,
"breed": "pomeranian",
"diet": {
"scoops": 3,
"timesPerDay": 2
}
}
and I want to update diet.timesPerDay
to 1 where the ID is "9e576f8b-146f-4e7f-a68f-14ef816e0e50"
. Can I do that using the Azure SQL API without completely replacing the document?
select
vsupdate / insert / delete
along with sdk calls to deal with those (though the updates done via SDK are still done as full document replacement, as Nick pointed out in his answer) - stackoverflow.com/a/46873986/272109 – David Makogon