I don't understand what is happening here. I have some code (which has been in place for ages). It looks like this:
public async Task CreateAsync(T model, string partitionKey)
{
await _client.CreateDocumentAsync(
UriFactory.CreateDocumentCollectionUri(
_databaseName,
_collectionName
),
model,
new RequestOptions
{
PartitionKey = new PartitionKey(partitionKey)
});
}
I have created a new database (cosmos db) and when I tried to save a record, I got the error:
PartitionKey extracted from document doesn't match the one specified in the header
Which is odd. It was working fine before and infact, if I take the json and use it in azure, it works perfectly. Someone else had a similar issue and they stated that the solution was to upgrade my packages (specifically JSON.NET) which I have done, but I am still getting the error.
The JSON I used, looks like this:
{
"_id" : ObjectId("5c3e516647d3c103a0ad0959"),
"gtin" : "4548736035652",
"modelAlias" : "KDL-32WD756",
"modelGroup" : "WD75",
"retailerTitle" : "Sony Bravia 32WD756BU LED HD 1080p Smart TV, 32 with Freeview HD & Cable Management System",
"shortTitle" : "Sony WD75 32 inch Black",
"summary" : "The Sony WD75 in Black is a smart TV, and comes with a 32 inch, full HD, LED screen.",
"variant" : "4548736035645",
"colour" : "Blacks",
"resolution" : "Medium",
"curved" : "No",
"panelType" : "LED",
"3D" : "No",
"size" : "Small",
"goodOnWall" : "No",
"darksAndBrights" : "Medium",
"refreshRate" : "Standard",
"richerColours" : "No",
"wiFi" : "Yes",
"smart" : "Yes",
"recordable" : "Yes",
"latestModel" : "No",
"soundQuality" : "Low",
"voiceActivated" : "No",
"inputs" : "Two",
"pictureQuality" : "Medium",
"brand" : "Sony",
"energyEfficiency" : "Medium",
"sizeBoundary" : "Upper small",
"mountabilityFunction" : "Bad",
"screenSize" : "31-40",
"viewingAngle" : "Wide",
"descriptions" : [
{
"criteriaName" : "Size",
"attributeName" : "Small",
"description" : "Compact screen size"
}
],
"categoryId" : "televisions",
"id" : "94305057-fc1f-3f88-cb74-7056e72077ac"
}