问题
I use SQL Api from azure cosmos and since yesterday I have this type of error. Sometimes this error comes back to me ... what can it be related to?
Can it be related to this metric situation?
I increased the RU / s so that I have enough for each physical partition.
But I always get the same error. I thought it was a problem related to low RU / s, but it isn't.
I use the current code:
try
{
client.ReadDocumentAsync(UriFactory.CreateDocumentUri(databaseName, collectionName, tripDocument.id));
CommonAzureCosmosDB.LogAzCDBCall(Convert.ToInt32(tripDocument.genKey.Split('_')[0]), "CreateTripDocument_read", tripDocument.genKey, DateTime.Now);
}
catch (DocumentClientException de)
{
if (de.StatusCode == HttpStatusCode.NotFound)
{
Microsoft.Azure.Documents.Document doc = client.CreateDocumentAsync(UriFactory.CreateDocumentCollectionUri(databaseName, collectionName), tripDocument).Result.Resource;
ret[0] = doc.Id;
CommonAzureCosmosDB.LogAzCDBCall(Convert.ToInt32(tripDocument.genKey.Split('_')[0]), "CreateTripDocument_httpNotFound", tripDocument.genKey, DateTime.Now);
}
else
{
throw (new Exception("DocumentClientException != HttpStatusCode.NotFound"));
}
}
The element to load:
{
"genKey": "428_2020_24-2020-26-1012817",
"id": null,
"dataType": "realCoords",
"emailStop": "ufficiotrasporti@centraleadr.coop.it",
"mobilePhoneStop": "",
"targetCoordinateStop": [
13.505125,
43.604742
],
"coordinate": [
12.3573497,
44.137045
],
"customerIntCode": 562,
"coordinateDate": "2020-12-03 14:02:00",
"coordinateDateAcq": "2020-12-03 14:05:00",
"plateNumber": "GA115MF",
"positionApprox": null,
"logicOrder": "r_20201203140827779"
}
The partition key is: genKey, formed by user_year_tripNumber
来源:https://stackoverflow.com/questions/65124170/azure-cosmos-db-when-create-a-new-document-one-or-more-errors-occurred