I am trying to perform an update on an existing item using ReplaceItemAsync.
I have added the value of my partitionKey and yet I still get an error and really unsure as to why. I have tried not setting a partitionKey at all and just using app and app.id and I have additionally tried setting the partitionkey as the path.
I have checked with the database portal and the ID matches up.
In the third image (of the cosmos portal) I am trying to update json The value I use for the partition key is of the new updated json and where I received the 404 error. I have tried using the value of the existing not yet updated json but then I am thrown a 400 bad request error.
image 1:
[
The reason you receive a 404 is because the partition key of your updated object is not identical to the one of your original object since you use the item.ToString() value.
Cosmos will not find an item within this partition key with the supplied Id, hence returning a 404.
In contrary to SQL, an id within a cosmos collection should only be unique within it's partition. The unique identifier of a document within a collection is the combination of the id and the partition key.