【发布时间】:2016-08-25 21:15:20
【问题描述】:
我是 Sails 的新手,在模型方面遇到了一个小问题。
我已经定义了一个用户模型如下:
module.exports = {
attributes: {
firstName: {
type: 'string'
},
lastName: {
type: 'string'
},
email: {
type: 'email',
required: true
},
password: {
type: 'String'
},
passwordSalt: {
type: 'String'
},
projects:{
collection: 'ProjectMember',
via: 'userId'
}
}
};
我还有一个名为 Plan 的模型,它的外键是 user:
module.exports = {
planId: { type: 'string'},
userId: { model: 'User'}
};
现在计划存储所有用户数据。有什么办法可以限制计划模型只保存一些用户详细信息,如名字、姓氏、电子邮件和 projectMembers,而不是存储其他个人信息。像密码,密码盐等?
提前致谢
【问题讨论】:
标签: node.js mongodb sails.js data-modeling waterline