sails-dynamodb
sails-dynamodb copied to clipboard
Unique not work
I created an attribute =
email: {
type: "email",
required: true,
unique: true
}
And when you run Insert, it does not perform validation to single in the table.
I'm not sure if unique
will work at all with this adapter. If there is support, you would need to set a hash index on that attribute. I don't see another way that it would work with dynamo. Want to try setting a hash on that and trying?
Is Email also your primary key? If so, you can set the attributes as:
email: {
type: "email",
required: true,
primaryKey: 'hash'
}
However, as far as I've seen, adding a duplicate entry for the primaryKey
through the adapter will overwrite the document that already exists with that particular primaryKey