Database Reference
In-Depth Information
UpdateItem
The following code (put in the request body) will update the item's (whose
BookTitle
is
SCJP
and
Author
is
Kathy
)
Language
attribute set to hold English, German, and Lat-
in. Updating will happen only if the older value of the language set is English and German.
This is the use of
Expected
.
{
"TableName": "Tbl_Book",
"Key": {
"BookTitle": { "S": "SCJP" },
"Author": { "S": "Kathy" } },
"AttributeUpdates": {
"Language": {
"Value": { "SS": ["English","German","Latin"]},
"Action": "PUT" } },
"Expected": {
"Language": {
"ComparisonOperator":"EQ",
"AttributeValueList": [ { "SS": ["English","German"]}
] }},
"ReturnValues": "ALL_NEW"
}
The following code will increment the
Edition
attribute value of the item whose
BookTitle
is
SCJP
and
Author
is
Kathy
:
{
"TableName": "Tbl_Book",
"Key": {
"BookTitle": { "S": "SCJP" },
"Author": { "S": "Kathy" } },
"AttributeUpdates": {
"Edition": {"Action": "ADD","Value": {"N": "1"} } },
"ReturnValues" : "NONE"
}