- 編輯一個存在的項的屬性,如果不存在這個項,向這個表中添加一個新的項。可以放入、刪除或添加屬性的值。還可以支持對一個已經存在的項目進行有條件的更新(如果不存在,則插入新的屬性名稱值對,或者如果存在某些預期的屬性值,則替換現有的名稱值對)。
你可以使用這個返回值參數以相同的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”]