DynamoDb范围键可以为空吗?

som*_*esh 14 amazon-dynamodb

我正在考虑将DynamoDb用于我的一个应用程序.

我想知道是否可以将属性设置为范围键,然后将其保留为未填充某些记录(空或空).

not*_*est 24

您不能将带有范围键的项目插入为空值或不使用范围键.

如果未包含Range键.你会得到以下错误: -

"One of the required keys was not given a value"
Run Code Online (Sandbox Code Playgroud)

如果Range键填充了''(即空字符串)

"message": "One or more parameter values were invalid: An AttributeValue may not contain an empty string"
Run Code Online (Sandbox Code Playgroud)

来自AWS Doc: -

添加项目时,主键属性是唯一必需的属性.属性值不能为null.字符串和二进制类型属性的长度必须大于零.设置类型属性不能为空.具有空值的请求将被ValidationException异常拒绝.

  • http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_PutItem.html (2认同)