这可能是一个显而易见的问题,但我没有在亚马逊的文档中看到它。
我可以将文档和键值对存储在同一个 DynamoDB 实例中吗?或者一个实例只能有一种类型吗?
我也不知道如何在编写项目时指定对象类型。
最佳答案
措辞令人困惑。主键确实需要是一种数据类型。
DynamoDB supports many different data types for attributes within a table. They can be categorized as follows:
Scalar Types – A scalar type can represent exactly one value. The scalar types are number, string, binary, Boolean, and null.
Document Types – A document type can represent a complex structure with nested attributes—such as you would find in a JSON document. The document types are list and map.
Set Types – A set type can represent multiple scalar values. The set types are string set, number set, and binary set.
When you create a table or a secondary index, you must specify the names and data types of each primary key attribute (partition key and sort key). Furthermore, each primary key attribute must be defined as type string, number, or binary.
DynamoDB is a NoSQL database and is schemaless. This means that, other than the primary key attributes, you don't have to define any attributes or data types when you create tables. By comparison, relational databases require you to define the names and data types of each column when you create a table.
关于nosql - 我可以将文档和键值对存储在同一个 DynamoDB 实例中吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48710850/