How to support transactions in dynamoDB with javascript aws-sdk?

前端 未结 3 423
傲寒
傲寒 2021-01-12 12:47

We have a microservice written in node.js & we use dynamoDB for data storage. Value is stored in json format against key. In update service call, we fetch value for a ke

3条回答
  •  旧时难觅i
    2021-01-12 13:08

    1. You can do atomic updates such as incrementing a number straight on Dynamo without reading, incrementing, updating. For more information see this

    2. Are both updates updating the same field? If so you can add a condition to the update that the old value equal what you read. That way if you try to save the 2nd new value, this condition will fail and it won't perform the 2nd update. See this

提交回复
热议问题