有没有办法设置mongoDB集合,这样即使一个人获得了对数据库的访问权限,他们也无法更改特定字段的值?
这是我的架构:
const UserSchema = new Schema({
firstName: {
type: String,
required: true
},
lastName: {
type: String,
required: true
},
email: {
type: String,
required: true
},
passwordDigest: {
type: String,
required: true
},
username: {
type: String,
required: true
},
isAdmin: {
type: Boolean,
default: false,
required: true
}
});
我想锁定isAdmin的值。有没有办法通过数据库设置硬连接这个?