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

前端 未结 3 403
傲寒
傲寒 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条回答
  • 2021-01-12 12:55

    Just released at 2018 re:invent, see the native transaction support in javascript sdk usage here: https://aws.amazon.com/blogs/aws/new-amazon-dynamodb-transactions/

    0 讨论(0)
  • 2021-01-12 13:06

    Recently there is an npm package that provides implementation of DynamoDb optimistic locking. See Dynameh. You can check that out.

    0 讨论(0)
  • 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

    0 讨论(0)
提交回复
热议问题