0
I have a Map format structure stored in Dynamodb, and would like to add another attribute within the school object, something like:
{
name: 'Felipe'
uid: 112233,
data: {
structure: {
school: {
name: 'beta'
}
}
}
}
previously the add_year was not part of the structure, so this part is new
school: {
name: 'beta'
add_year: '2020'
}
How can I get it?
I tried the following solutions, but without success
(async ()=>{
try {
let teste = await dynamoDb.updateItem({
TableName: 'test',
Key: {
uid: "112233"
},
UpdateExpression: "SET data.#structure.#school = list_append(#structure, :attrValue)",
ExpressionAttributeNames: {
"#data": "data",
"#structure": "structure",
"#school": "school",
},
ExpressionAttributeValues: {
":school":{
"add_year": 2020
}
},
ReturnValues:"UPDATED_NEW "
})
console.log('update',teste)
} catch (error) {
console.log(error)
}