Let's say that I am storing records with following structure in DynamoDB:
{
"id": "57cf5b43-f9ec-4796-9de6-6a50f556cfd8",
"created_at": "2015-09-18T13:27:00+12:00",
"count": 3
}
Now, is it possible to achieve the following in one request:
- if the record with given
id
doesn't exist it should be created with count = 1 - if the record for that
id
exists the counter is being updated.
Currently I'm doing a query to check if the record exist and depending on the result I do a put
or an update
. It would be nice to fold that into a single operation.