DynamoDB conditional update by checking the attribute value length

Viewed 1230

One of the attributes in my DynamoDB table is a list called REQUEST_IDS, and I want to check the length of that list to see if it satisfies a condition (less than 10) before update the item. How can I refer to the array length in my ConditionExpression in nodejs? Is this doable?

1 Answers

You are looking for the conditional operation size (docs)

In your case: ConditionExpression: 'size(REQIEST_IDS) < 10

Related