- 编辑一个存在的项的属性,如果不存在这个项,向这个表中添加一个新的项。可以放入、删除或添加属性的值。还可以支持对一个已经存在的项目进行有条件的更新(如果不存在,则插入新的属性名称值对,或者如果存在某些预期的属性值,则替换现有的名称值对)。
你可以使用这个返回值参数以相同的updateitem操作返回这个项目的属性值。 - 请求语法
{
"AttributeUpdates": {
"string" : {
"Action": "string",
"Value": {
"B": blob,
"BOOL": boolean,
"BS": [ blob ],
"L": [
"AttributeValue"
],
"M": {
"string" : "AttributeValue" },
"N": "string",
"NS": [ "string" ],
"NULL": boolean,
"S": "string",
"SS": [ "string" ]
}
}
},
"ConditionalOperator": "string",
"ConditionExpression": "string",
"Expected": {
"string" : {
"AttributeValueList": [
{
"B": blob,
"BOOL": boolean,
"BS": [ blob ],
"L": [
"AttributeValue"
],
"M": {
"string" : "AttributeValue" },
"N": "string",
"NS": [ "string" ],
"NULL": boolean,
"S": "string",
"SS": [ "string" ]
}
],
"ComparisonOperator": "string",
"Exists": boolean,
"Value": {
"B": blob,
"BOOL": boolean,
"BS": [ blob ],
"L": [
"AttributeValue"
],
"M": {
"string" : "AttributeValue" },
"N": "string",
"NS": [ "string" ],
"NULL": boolean,
"S": "string",
"SS": [ "string" ]
}
}
},
"ExpressionAttributeNames": {
"string" : "string"
},
"ExpressionAttributeValues": {
"string" : {
"B": blob,
"BOOL": boolean,
"BS": [ blob ],
"L": [
"AttributeValue"
],
"M": {
"string" : "AttributeValue"
},
"N": "string",
"NS": [ "string" ],
"NULL": boolean,
"S": "string",
"SS": [ "string" ]
}
},
"Key": {
"string" : {
"B": blob,
"BOOL": boolean,
"BS": [ blob ],
"L": [
"AttributeValue"
],
"M": {
"string" : "AttributeValue"
},
"N": "string",
"NS": [ "string" ],
"NULL": boolean,
"S": "string",
"SS": [ "string" ]
}
},
"ReturnConsumedCapacity": "string",
"ReturnItemCollectionMetrics": "string",
"ReturnValues": "string",
"TableName": "string",
"UpdateExpression": "string"
}
AttributeUpdates:这是一个遗留参数,使用UpdateExpression 代替了,类型是Map
Value:代表属性的数据,每个属性的值为一个键值对,键是数据类型,值是这个数据本身,类型:属性值对象,required=NO
B:二进制类型的属性,类型是base64编码的二进制数据对象,Required: No
BOOL:Boolean类型的属性,类型是boolean,Required: No
BS:二进制类型集的属性,类型:base64编码的二进制数据对象的数组,Required: No
L:属性类型的集,例子:”L”: [“Cookies”, “Coffee”, 3.14159],类型是: AttributeValue 对象的数组,Required: No
AttributeValue :代表一个属性的数据,每个属性值都被描述为一个名称值对。名称是数据类型,其值是数据本身。
M:map类型的属性,例如:”M”: {“Name”: {“S”: “Joe”}, “Age”: {“N”: “35”}},长度最大不超过65535
N:数字类型属性,例如:”N”: “123.45”。
数据通过网络发送给DynamoDB为字符串,最大限度地跨越语言和库的兼容性。然而,DynamoDB对待数学操作数的类型属性。,类型:string,Required: No
NS:数字集,例如:”NS”: [“42.2”, “-19”, “7.5”, “3.14”]。数据通过网络发送给DynamoDB为字符串,最大限度地跨越语言和库的兼容性。然而,DynamoDB对待数学操作数的类型属性。类型:字符数组
NULL:空类型属性,”NULL”: true,类型boolean,Required: No
s:字符串类型的属性,例如”S”: “Hello”,Type: String,Required: No
SS:字符串set集,例如”SS”: [“Giraffe”, “Hippo” ,”Zebra”]