1 Answer
- Newest
- Most votes
- Most comments
0
You can do an update item and just set the value for one attribute. Client1 can set a1=10 and client2 can set a2=10, that is no problem.
# aws dynamodb put-item --table-name test --item '{"pk": { "S": "1" }}'
# aws dynamodb get-item --table-name test --key '{"pk": { "S": "1" }}'
{
"Item": {
"pk": {
"S": "1"
}
}
}
# aws dynamodb update-item --table-name test --key '{"pk": { "S": "1" }}' --update-expression "SET a1 = :a1" --expression-attribute-values '{":a1" : {"N":"10"}}' --return-values ALL_NEW
{
"Attributes": {
"a1": {
"N": "10"
},
"pk": {
"S": "1"
}
}
}
# aws dynamodb update-item --table-name test --key '{"pk": { "S": "1" }}' --update-expression "SET a2 = :a2" --expression-attribute-values '{":a2" : {"N":"10"}}' --return-values ALL_NEW
{
"Attributes": {
"a1": {
"N": "10"
},
"pk": {
"S": "1"
},
"a2": {
"N": "10"
}
}
}
answered 5 years ago
Relevant content
- asked 5 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated 2 years ago
There is no problem when attributes are different and updating at the same time and same item? what if are nested object, but different attributes?