DocumentDB ReplaceDocument Fails
alternatively you can tell Cosmos to use camelCasingWhichIsStandardForJson
new CosmosClient(
connectionstring,
new CosmosClientOptions(){
SerializerOptions = new CosmosSerializationOptions(){
PropertyNamingPolicy = CosmosPropertyNamingPolicy.CamelCase
}
}
)
OK I figured it out.
Each Document in DocumentDB needs to have an "id" property. If a class does not have one, it will get assigned one and saved into the document. With DocumentDB being case sensitive, my "Id" was just another property and a separate "id" was added and assigned to the document.
I fixed the issue by deleting and recreating all my documents with the following attribute for Id:
[JsonProperty(PropertyName = "id")]
public Guid Id { get; set; }