Dynamo DB Attribute type boolean

会有一股神秘感。 提交于 2019-12-12 01:06:00

问题


Why can an attribute definition only be of types `{string, number, binary).

See Java SDK class com.amazonaws.services.dynamodbv2.model.AttributeDefinition or documentation.

What if I am trying to define a boolean attribute of type BOOL as mentioned here or here as a distinct type from a number (perhaps this is already the problem, maybe I shouldn't be trying to do this?)

I'm not clear why I cannot define the attribute type explicitly as BOOL. Is this because it's actually just a number 0/1? I would have assumed the above, had it not been for other documentation which talks about booleans as distinct type and annotations in the Java SDK like com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBConvertedBool or @DynamoDBTyped(DynamoDBMapperFieldModel.DynamoDBAttributeType.BOOL) which again seems to indicate that there is some type of distinct definition that can be used.

|improve this question

回答1:


This only is the case for key attributes

Each primary key attribute must be a scalar (meaning that it can hold only a single value). The only data types allowed for primary key attributes are string, number, or binary. There are no such restrictions for other, non-key attributes.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.CoreComponents.html#HowItWorks.CoreComponents.PrimaryKey



来源:https://stackoverflow.com/questions/51930418/dynamo-db-attribute-type-boolean

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!