I recently realized that DocumentDB supports standalone update operations through ReplaceDocumentAsync.
I replaced the Upsert operation below with a Replace operation.
var result = _client .UpsertDocumentAsync(_collectionUri, docObject) .Result;
So now:
var result = _client .ReplaceDocumentAsnyc(_collectionUri, docObject) .Result;
However, now I get an exception:
Microsoft.Azure.Documents.BadRequestException: ResourceType document is unexpected. ActivityId: b1b2fd71-3029-4d0d-bd5d-87d8d0a2fc95
I donβt know why, upsert and replace have the same key, and the object is the same as upsert, so I expect it to work without problems.
All help was appreciated.
thanks
Update: We tried to implement this using the SelfLink approach, and it works for Replace, but self-loading does not work with Upsert. The behavior is rather confusing. I do not like that I need to create my own link in the code using string concatenation.
source share