I am trying to add more email address to the list. The architecture and the example in Dynamo DB
ID: STRING
DEP: MAP
Contacts: MAP
EMAIL: LIST
Version: Number
{
“ID”: "1234567888",
"Dep": {
"Contacts": {
"Email": [
"test@test.com”
]
}
},
"Version": 34
}
I tried but it just updates the value but don't add the new one. (if you can also help me with if the value does not exist than only add would be nice but not mandatory)
$eav = $marshaler->marshalItem([":email" => [$email]]);
$params = ['TableName' => "xxx", 'ID' => $key,
'UpdateExpression' => 'SET Dep.Contacts.Email = :email',
'ExpressionAttributeValues' => $eav, 'ReturnValues' => 'UPDATED_NEW'];
$result = $dynamodb->updateItem($params);