Can I add to multi-valued attributes in DynamoDB?

Can I add values ​​to a list of multi-valued attribute in an Amazon DynamoDB table? I am not quite able to figure this out using the put query. I would like, if possible, to avoid reading, updating, and writing.

+6
source share
1 answer

Assuming you reference String and Number Sets as described in Amazon DynamoDB Data Types , this is possible in Amazon DynamoDB with UpdateItem :

ADD - Use only the add action for numbers or if the target attribute is a collection (including a collection of strings). ADD does not work if target is a single line value. The specified value is added to the numerical value (increasing or decreasing the existing numerical value) or added as an additional value in the rowset. If a set of values ​​is specified, the values ​​are added to the existing set. For example, if the source set is [1,2], and the supplied value is 3 , then after the addition operation the set is [1,2,3], and not [4,5]. [...] [emphasis mine]

+7
source

Source: https://habr.com/ru/post/915812/


All Articles