是否可以在DynamoDB中附加到多值属性? [英] Is it possible to append to multi-valued attributes in DynamoDB?

查看:93
本文介绍了是否可以在DynamoDB中附加到多值属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在Amazon DynamoDB表的多值属性中附加值列表?我不太能够使用put请求弄清楚。我想尽可能避免读取,更新,写入逻辑。

Is it possible to append to the list of values in a multi-valued attribute in an Amazon DynamoDB table? I am not quite able to figure it out using the put request. I would like to avoid the read, update, write logic if possible.

推荐答案

假设您是指 String和亚马逊中概述的数字集 DynamoDB数据类型,这可以在 Amazon DynamoDB 中通过 UpdateItem 操作确实是:

Assuming you are referring to String and Number Sets as outlined in Amazon DynamoDB Data Types, this is possible in Amazon DynamoDB by means of the UpdateItem operation indeed:

ADD — 仅对数字或目标属性为集合(包括字符串集合)的情况下使用添加操作。如果
目标属性是单个字符串值,则ADD不起作用。指定的值是
添加到一个数值(递增或递减现有的
数值)或作为附加值添加到字符串集中。如果指定了
值集,则将值添加到现有的值集中。

例如,如果原始值是[1,2],并且提供的值是 3
,然后在添加操作之后,集合为[1,2, 3],而不是[4,5]。 [...]
[强调我]

ADD— Only use the add action for numbers or if the target attribute is a set (including string sets). ADD does not work if the target attribute is a single string value. The specified value is added to a numeric value (incrementing or decrementing the existing numeric value) or added as an additional value in a string set. If a set of values is specified, the values are added to the existing set. For example if the original set is [1,2] and supplied value is 3, then after the add operation the set is [1,2,3], not [4,5]. [...] [emphasis mine]

这篇关于是否可以在DynamoDB中附加到多值属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆