Anyone with dynogels experience might be able to help me on this one.
Simplified example of my dynamodb table with a nested structure
{
key: xxxxx,
maintenance: {
date1: xxxxxxxx,
date2: xxxxxxxx
}
}
If I update the table and send the below as the update params
key: 1,
maintenance: {
date2: 1970-01-18T09:45:55.452Z
}
then date1: gets trashed from my item in the table
Is there some config option in the update call that Im making that I'm missing somewhere to NOT delete values that I dont want to touch/update?
Thanks
You can use dot notation in your UpdateExpression
in order to set values for nested properties.
var params = {};
params.UpdateExpression = 'SET #maintenance.date2 = :date2';
params.ExpressionAttributeNames = {
'#maintenance' : 'maintenance',
};
params.ExpressionAttributeValues = {
':date2' : '1970-01-18T09:45:55.452Z',
};
Model.update({key : 1}, params, function (err, model) {});