This model gives me the effect that I want due to duplicate data and general ugliness:
//Example var Example = { attributes: { foo: { type: 'string', required: true }, bar: { type: 'string', required: true, }, baz: { type: 'integer', required: true, min: 1 }, foobar: { type: 'string', unique: true } }, beforeValidation : function(values,cb) { values.foobar = values.foo+values.bar; cb(); } }; module.exports = Example;
Is there a better strategy for creating a composite unique key?
source share