Dynamo DB: How to update specific object inside an array in aws dynamodb?

Viewed 15

Inside my companies table there is a company collection I have an array of users. I need to change one of the users name ('David' to 'Solomon').

I don't mind changing to insert a new user object instead David. But I don't mind to keep the same id and just change the name field from 'David' to 'Solomon'

company: {
    id: cde9e41d-8d16-4054-907f-cc92a69d68e0
    name: 'Gold Crowns Ltd',
    users: [
        {
            id: abc9e41d-8d16-4054-907f-cc92a69d68e0
            name: 'David' // <-------- I want to change 'David' to 'Solomon'
        },
        {
            id: fgh9e41d-8d16-4054-907f-cc92a69d68e0
            name: 'Saul'
        },
    ],
}

Which option will work best and what should be the query in DynamoDB

0 Answers
Related