I’ve been using CosmosDb to store various documents, so far no problems. Now I’ve created a new Container, using partition key /id, and storing this data model:
public class AudioFileStorage
{
public string Id { get; set; }
public string FileName { get; set; }
public AudioFileType AudioType { get; set; }
public DateTime UploadDate { get; set; }
public string UploadedBy { get; set; }
public byte[] Contents { get; set; }
}
public enum AudioFileType
{
Audio1, Audio2, Audio3
}
I also have a peculiar syntax I’m using for the Id
property. My records look something like this: ownerId/x/Filename.
Now, if I try to delete the inserted items
var deleteRes = await container.DeleteItemAsync<AudioFileStorage>(existing.Id, new PartitionKey(existing.Id)).ConfigureAwait(false);
(existing is an instance of an AudioFileStorage
object that I’ve extracted.. so I know the Id I’m providing is correct), I’m getting the (by now dreaded) HTTP 400 with no reason:
Response status code does not indicate success: BadRequest (400);
Substatus: 0; ActivityId: edd2f449-6865-45c7-92df-34214fdbc8dc;
Reason: ();
What do I do to troubleshoot this?
Note that I’m options.SerializerOptions.PropertyNamingPolicy = CosmosPropertyNamingPolicy.CamelCase;
to use camelCase notation for my properties, so there’s no [JsonProperty("id")]
override on the Id
property.