const mongoose =require(‘mongoose’)
const scheama =new mongoose.Schema({
username: {type:String},
password: {
type:String,
select:false,
set(val){
return require(‘bcrypt’).hashSync(val,10)
}
},
})
module.exports =mongoose.model(‘AdminUser’,scheama)
//select:false不显示密码
//bcrypt密码加密