nosql - 我可以将文档和键值对存储在同一个 DynamoDB 实例中吗?

标签 nosql amazon-dynamodb aws-sdk

这可能是一个显而易见的问题,但我没有在亚马逊的文档中看到它。

我可以将文档和键值对存储在同一个 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.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.NamingRulesDataTypes.html

关于nosql - 我可以将文档和键值对存储在同一个 DynamoDB 实例中吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48710850/

相关文章:

java - DynamoDB 仅部分更新

amazon-dynamodb - AWS AppSync查询以成形响应数据(类似于SQL中的分组依据)

nosql - couchbase 分析是否支持所有 N1QL 命令?

java - java.lang.String 类型中没有@DynamoDBHashKey 注释的方法或字段

Hadoop 与 NoSQL 数据库

c# - 亚马逊 AWSClientFactory 不存在

javascript - AWS S3 SDK : Abort a putObject upload in progress

json - 获取 Postgres NOSQL json 数据中 json 数组的总和

java - DynamoDBMapper : Non-set collections aren't supported when try to convert a list

javascript - 如果当前状态 !== 'FINISH',则使用 ConditionExpression 仅更新状态