doufu8588 2013-06-20 01:27
浏览 35
已采纳

updateItem'Expected'检查字符串集中的一个值

I am trying to do a conditional updateItem call using php SDK2, but having trouble figuring out how to check for only a single value within a string set.

For Exmple: I have a string set in dynamoDB:

{"a","b","c"}

I want to do an updatedItem call, and delete one of those values, but error out if the value doesn't exist. So, if I attempted to remove "d" from the above set, I want dynamoDB to throw an error, not just silently ignore the fact that "d" doesn't exist in my string set.

I've tried:

    'Expected' => array(
        myAttribute => array(
            'Exists' => true,
            'Value' => array(Type::STRING_SET => array("d"))
        )
     )

This fails, however, even if the value was, for example, "a". I think the reason is that dynamoDB thinks I want it to validate the entire set, not just one value in it.

Is there a way to do a conditional put and verify just a single value within the set?

I can do a getItem call, grab the string set as an array and do my own checking, but I'd love to do it all in one call if possible.

Thanks in advance

  • 写回答

1条回答 默认 最新

  • dongqindu8110 2013-06-24 17:09
    关注

    Looking at the UpdateItem seems to indicate that DynamoDB looks at the value as a whole, and that you cannot have a condition based on a value within a set.

    If you want a solid confirmation about whether or not you can do this or if you want to make a feature request for it, I would post on the official DynamoDB forum.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序