It looks like you are trying to update an item by using an Expression, and in this case, your UpdateExpression
is incorrect. Both the ExpressionAttributeNames
and ExpressionAttributeValues
are used for placeholder substitution in your expression.
I think your code would look something like this, if you want to set an attribute for an item:
dynamoDB.updateItem({
"TableName" : "exampleTable",
"Key" : {
"hashAttributeName" : {
"S" : "thing_ID"
}
},
"UpdateExpression" : "SET #attrName =:attrValue",
"ExpressionAttributeNames" : {
"#attrName" : "SessionID"
},
"ExpressionAttributeValues" : {
":attrValue" : {
"S" : "maybe this works"
}
}
});
This will update an item that looks like this:
{
"Item":{
"hashAttributeName":"thing_ID"
}
}
To this:
{
"Item":{
"hashAttributeName" : "thing_ID",
"SessionID" : "maybe this works"
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…