amazon web服务-DynamoDB更新列表字段中的重复记录
发布时间:2022-04-27 12:39:20 231
相关标签:
我正在使用以下参数对DynamoDB表执行更新(或创建,如果它不存在):
{
"TableName": "TableName",
"Key": {
"PartitionKey": "TEST#",
"SortKey": "SK#123456"
},
"UpdateExpression": "set WaterTests = list_append(if_not_exists(WaterTests, :empty_list), :waterTestValues), MakeModel = :mm, Version = :v, Username = :username",
"ExpressionAttributeValues": {
":waterTestValues": [
{
"DateTest": "2022-03-29T09:40:50.985Z",
"IsValid": true,
"S3Path": "sample/s3/path"
}
],
":v": "v1",
":mm": "No Make Model",
":username": "no.user@redacted.com",
":empty_list": []
},
"ReturnValues": "UPDATED_NEW"
}
它总是会产生以下结果(对于不存在的记录,为unique HK+SK):
{
"PartitionKey": "SESSION#",
"SortKey": "USER#no.user@redacted.com#999fe1b3-0b59-4a41-9eef-37d433566af0",
"WifiTests": [
{
"DateTest": "2022-03-29T09:40:50.985Z",
"IsValid": true,
"S3Path": "sample/s3/path"
},
{
"DateTest": "2022-03-29T09:40:50.985Z",
"IsValid": true,
"S3Path": "sample/s3/path"
}]...
我使用的标准更新调用如下:
await docClient.update(params, function (err, data) {
if (err) console.log(err);
else console.log(data);
}).promise();
我不知道为什么复制总是发生。
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报