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

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -