Amazon web services Dynamo.DB中的必需属性

Amazon web services Dynamo.DB中的必需属性,amazon-web-services,amazon-dynamodb,nosql,Amazon Web Services,Amazon Dynamodb,Nosql,我正在使用Dynamo.DB,并在Node.JS中使用了以下“”;我想知道如何将属性设置为“必需” 这里有一个我在文档中找到的示例,但我不确定我们是否可以在Dynamo.DB中有“required”属性 // flat [string, number, string array or number array] based json object var item = { score: 304, date: (new Date).getTime(),

我正在使用Dynamo.DB,并在Node.JS中使用了以下“”;我想知道如何将属性设置为“必需”

这里有一个我在文档中找到的示例,但我不确定我们是否可以在Dynamo.DB中有“required”属性

// flat [string, number, string array or number array] based json object
var item = { score: 304,
             date: (new Date).getTime(),
             sha: '3d2d6963',
             usr: 'spolu',
             lng: ['node', 'c++'] };

ddb.putItem('a-table', item, {}, function(err, res, cap) {});

我想你做不到。只有主键是必需的,因为DynamoDB是“无模式的”,所以在无模式的数据库中的字段上有一个必需的属性是没有意义的。

正确-DynamoDB(无模式的数据库)中没有办法将属性标记为必需的(主键除外)。一个例外是,如果您将项放在包含索引键(它们是可选的)的具有二级索引的表中,则它们的类型必须与您在CreateTable调用的索引架构中定义的类型相同。因为DynamoDB是“无架构”的,我想知道对不是分区(主键)键的字段使用
属性定义
有什么好处吗?无论是否在
AttributeDefinitions
中使用
{AttributeName:“…”,AttributeType:“…”}
DynamoDB将保存该字段。