Add or remove an entry from a List type attribute in a DynamoDB table item

后端 未结 3 794
忘了有多久
忘了有多久 2020-12-04 02:14

I have a very simple class, with a string type primary key and List type attributes. I want to write an API for adding and removing an item from the attribute list, and savi

3条回答
  •  不知归路
    2020-12-04 02:21

    The accepted answer is incorrect, the correct way of doing this is listed in the DynamoDB UpdateExpression documentation

    You need to read the list then get the index of the item you're looking to remove then run REMOVE list[index] as an UpdateExpression

提交回复
热议问题