php - Waterline in SailsJS doesn't seem to catch unique constraint -
php - Waterline in SailsJS doesn't seem to catch unique constraint -
in sailsjs, when have attribute on model like:
email: { type: 'email', unique: true}
for reason, waterline doesn't grab duplicates, of course of study mongo does. throws mongo error, waterline never catches wlvalidationerror.
anyone having error? can't seem wlvalidationerror work.
thanks
i've had problem too, overcome added user model. not implementation, worked me when nil else did.
beforecreate: function(values, cb) { user.findone({email : values.email}, function(err, user){ if(user){ homecoming cb('e-mail address existis'); } else { cb(); } }); }
docs here:
https://github.com/balderdashy/waterline#lifecycle-callbacks
php mongodb validation sails.js waterline
Comments
Post a Comment