Java – add / remove items to the array in Amazon dynamodb

I'm looking for the most efficient atomic method to add an item to an array in a dynamodb object Now, I see that the only way to add content to the array atomically is to use the versioning method: get the field to be updated, add / remove values, and perform conditional updates using the "version" field in the row But it doesn't seem efficient to me Is there a better way?

Solution

The updateitem operation has add and delete operations If used on a collection, the operation adds / removes the specified value from the collection If used on a number, the add action increments or decrements the number atomically

It is important to remember that dynamodb actually supports collections, not arrays Therefore, adding or deleting values is atomic in nature

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>