Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DynamoDB conditional update by checking the attribute value length

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?

like image 334
Nisman Avatar asked Mar 11 '26 04:03

Nisman


1 Answers

You are looking for the conditional operation size (docs)

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

like image 116
thomasmichaelwallace Avatar answered Mar 13 '26 14:03

thomasmichaelwallace



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!