我的数据如下:
{
name:'name'
email:'email'
password:'pass'
role:{checked: {'1' : true, '2': true ... any number of key value pairs}}}
}
如何为此类数据创建mongoose模式 ?
var CustomUserSchema = new Schema({
name: String,
email: { type: String, lowercase: true },
role: {
checked: { type: Number, type: boolean } //I need to define something like this here probably
},
hashedPassword: String,
provider: String,
salt: String
});
如何为此定义架构?基本上我将复选框值存储在角色字段中。
复选框字段的ng模型设置为user.role.checked[$index]