How to update an item in Dynamodb of type String Set (SS)?

前端 未结 3 1121
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-14 00:04

I have created a attribute of type String Set. When I create the Item and assign an attribute of type SS everything works. But when I try to update this attribute, the data type

3条回答
  •  星月不相逢
    2021-02-14 00:17

    This is an artifact of using the DocumentClient - StringSet is not a JSON type.

    The DocumentClient converts a StringSet to the Array native JavaScript type: https://github.com/aws/aws-sdk-js/blob/master/lib/dynamodb/converter.js#L61. Then the client serializes the native JavaScript Array as a DynamoDB List type: https://github.com/aws/aws-sdk-js/blob/master/lib/dynamodb/converter.js#L12.

    If you want to use the StringSet type, you can use the low-level API: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html

提交回复
热议问题