For an 'id' in my DynamoDB table (e.g. e5eb02ae-04d5-4331-91e6-11efaaf12ea5
), i have a column called Weather
['sun', 'rain', 'snow', etc...]
I need to update Weather when, say ['hail'] arrives. Right now, my update() below, replaces the the entire array. All i want to do is append 'hail' to the end of that list.
const updateinfo = {
id: "e5eb02ae-04d5-4331-91e6-11efaaf12ea5",
Weather: "hail"
}
try {
await API.graphql(graphqlOperation (UpdateInfo, { input: updateinfo })) //mutation
console.log('success')
}
catch (err) {
console.log(err)
}
How do i do this, ensuring that my list is just appended to with the info, WITHOUT having to get() and pull down ['sun', 'rain', 'snow', etc...], then adding 'hail' and creating a new array? Thats then a GetInfo() and an UpdateInfo() which is double the effort/call/expense.