DynamoDB Vogels中索引字符串集的ValidationException
ValidationException with Indexing stringSet in Vogels for DynamoDB
这是我的模型定义:
var Notification = vogels.define('Notification', {
tableName: 'notification',
hashKey: 'notification_id',
rangeKey: 'createdAt',
timestamps: true,
schema: {
notification_id : vogels.types.uuid(),
badge: joi.number().integer(),
delay: joi.number(),
action: joi.string(),
body: joi.string(),
tags: vogels.types.stringSet()
},
indexes: [{
hashKey : 'tags',
rangeKey: 'createdAt',
name : 'TagsIndex',
type : 'global'
}]
});
然而,当我想创建这个表时,我会得到以下错误:
Error creating tables: { [ValidationException: Member must satisfy enum value set: [B, N, S]]
message: 'Member must satisfy enum value set: [B, N, S]',
code: 'ValidationException',
time: Thu May 12 2016 14:06:44 GMT-0700 (PDT),
requestId: 'c775c989-c723-4d55-b319-731230a5991b',
statusCode: 400,
retryable: false,
retryDelay: 0 }
问题出在index
上。我去掉它,然后它就可以正常工作了。
发生此错误是因为不能将SET数据类型与Hash/Hash Range键一起使用。
只有字符串、数字和二进制数据类型可以用于键,这就是错误所暗示的。
文档链接明确提到我们不能使用集合。
希望能有所帮助。
相关文章:
- 没有找到相关文章