Azure cosmos Db when create a new document -> One or more errors occurred [closed]

眉间皱痕 提交于 2020-12-27 06:01:45

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!