DynamoDB - Put item if hash (or hash and range combination) doesn't exist

后端 未结 6 1167
误落风尘
误落风尘 2020-12-05 00:32

Here are my use cases: I have a Dynamo table with a hash + range key. When I put new items in the table, I want to do a uniqueness check. Sometimes I want to guarantee th

6条回答
  •  佛祖请我去吃肉
    2020-12-05 00:45

    You can use AND operation if your table has hash and range

    'ConditionExpression' => 'attribute_not_exists(hash) AND attribute_not_exists(range)'

提交回复
热议问题