モデルで一意のフィールドを定義しましたが、テストしようとすると、Error (E_UNKNOWN) :: Encountered an unexpected error:
MongoError: E11000 duplicate key error index:
代わりに帆の ValidationError が発生するため、帆によってチェックされていないようです。
帆のユニークなフィールドを処理する最良の方法は何ですか?
// 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 goes with update it throws error
よろしくお願いします。