2 Respostas
- Mais recentes
- Mais votos
- Mais comentários
1
Not answering the question but why use the PK and SK as the conditions? You're already supplying them as part of the DeleteItem call - you don't need to further specify them as conditions. Conditions are there so that you can specify other attributes in the record.
1
While it is possible to use ConditionExpressions
with a DeleteItem
, I believe your understanding on how it works is wrong. When using a ConditionExpression
on a Put/Delete/Update you only evaluate the item which you are operating on, DynamoDB does not look at any other items in the table.
This is the reason why begins_with(SK, :v2)
is giving you issues. You already know the sort key begins with that, so there is no need for the condition.
Conteúdo relevante
- AWS OFICIALAtualizada há 7 meses
- AWS OFICIALAtualizada há 2 anos
- AWS OFICIALAtualizada há 3 meses
Oh because in the table I have SK as TEST#414fbe9f-1675-47a1-9c3d-f40cb7a25c51#DATE#1700671174102 (composed of testId and Date) and I would like to find SK that begins with TEST#414fbe9f-1675-47a1-9c3d-f40cb7a25c51 (testId only).
Is this the wrong way about deleting an item? Just want to delete an item that matches PK and SK that starts with something.
Just found out that I can't do ConditionExpression of PK and SK. Thank you for the clue