How do I handle a Unique Field in sails?
I've defined a unique field in my model but when I tried to test it seems like it's not being checked by sails because I get a Error (E_UNKNOWN) :: Encountered an unexpected error: MongoError: E11000 duplicate key error index: instead a sails ValidationError. What is the best way to handle a unique field in sails? // model/User.js module.exports{ attributes: { email: {required: true, unique: true, type: 'email' }, .... } // in my controller User.create({email: 'hello@gmail.com'}).then(...).fail(....) User.create({email: 'hello@gmail.com'}).then(...).fail(// throws the mongo error ) // and same