Ida*_*ter 3 c# amazon-dynamodb
我想知道如何将Amazon DynamoDB表中的字段增加1.根据我的理解,我需要使用UpdateItemwith Action ADD但我无法做到.
我需要一个例子,如何在C#中做到这一点.让我们假设一个带有idhash 的表和一个count在创建行时设置为0的计数器.
注意:在使用旧版本完成此问题 ID的亚马逊上页面的引用,我需要使用V2的解决方案.
谢谢.
您需要构建的请求如下所示:
var request = new UpdateItemRequest
{
TableName = "Table",
Key = new Dictionary<string, AttributeValue>
{
{ "id", new AttributeValue { N = "5" } }
},
AttributeUpdates = new Dictionary<string, AttributeValueUpdate>()
{
{
"count",
new AttributeValueUpdate { Action = "ADD", Value = new AttributeValue { N = "1" } }
},
},
};
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1775 次 |
| 最近记录: |