gpt4 book ai didi

amazon-dynamodb - DynamoDB 更新异常 : Type mismatch for attribute to update

转载 作者:行者123 更新时间:2023-12-04 06:57:59 24 4
gpt4 key购买 nike

我在 DynamoDB 中有以下记录:

    {
"BusinessNo": {
"N": "12345"
},
"Metadata": {
"M": {
"MimeType": {
"S": "audio/wav"
},
"FileName": {
"S": "00032329.wav"
},
"CustomC": {
"S": "baz"
},
"CustomA": {
"S": "foo"
},
"CustomB": {
"S": "bar"
},
"Size": {
"S": "3992020323"
}
}
},
"Id": {
"S": "f0de8af3-a7f5-4d9b-ad5d-b2f150abd15e"
},
"Revision": {
"N": "2"
}
}

但是当我使用 update 提交以下内容时 DynamoDB.DocumentClient的方法来自 nodejs AWS SDK(我也试过 add 而不是 set ):
{
"TableName": "Storage_FileMetadata",
"Key": {
"Id": "f0de8af3-a7f5-4d9b-ad5d-b2f150abd15e",
"BusinessNo": "12345"
},
"ExpressionAttributeNames": {
"#m": "Metadata",
"#k": "CustomD",
"#r": "Revision"
},
"ExpressionAttributeValues": {
":r": 4,
":v": "doo-wop"
},
"UpdateExpression": "set #m.#k = :v",
"ConditionExpression": "#r < :r"
}

我收到以下异常:
{
"message": "Type mismatch for attribute to update",
"code": "ValidationException",
"time": "2016-11-11T18:55:01.543Z",
"requestId": "b9d78c87-1c4d-400a-8968-d761b657cd53",
"statusCode": 400,
"retryable": false,
"retryDelay": 0
}

我想我遗漏了一些关于添加/更新嵌套属性的内容,但在阅读后 the docs我想不通是什么。

最佳答案

似乎您需要将值 "BusinessNo": "12345"作为数字发送

"Key": {
"Id": "f0de8af3-a7f5-4d9b-ad5d-b2f150abd15e",
"BusinessNo": 12345
}

关于amazon-dynamodb - DynamoDB 更新异常 : Type mismatch for attribute to update,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40554566/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com