【发布时间】:2013-08-25 19:48:04
【问题描述】:
有没有办法在 Sails.js 中做模型之间的关系映射?
这是我想要的:
视频.js:
module.exports = {
attributes: {
filename: 'STRING',
length: 'INTEGER',
watchCount: 'INTEGER',
extension: 'STRING'
user: // I wan to reference to my User.js model
}
};
在我的 User.js 中:
module.exports = {
attributes: {
username: {
type: 'email',
required: true
},
password: 'STRING',
videos: // I would like to have an array of videos after querying a user
}
};
【问题讨论】:
标签: javascript node.js mapping one-to-many sails.js