Hier ist meine Bestimmung des Modells:Validation mit Indexing stringset in Vogel für 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'
}]
});
Allerdings, wenn ich diese Tabelle erstellt werden soll, bekomme ich folgende Fehlermeldung:
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 }
Das Problem ist, mit der index
. Ich entferne das, dann funktioniert es gut.
Fair genug. Wie indexiere ich dann Tags, damit ich nach ihnen suchen kann? Ich möchte nicht 'scannen' verwenden, da dann die gesamte DB gelesen wird. – Kousha
@Kousha, hier ist eine meiner Antwort, die hilfreich sein könnte http://stackoverflow.com/a/34349180/2811189 –