我将 Waterline 与 Sails.js 结合使用。
我想要一个具有参与的用户。一个事件可以有多个参与。 参与具有状态。
我的用户类别:
module.exports = {
attributes: {
involvements: {
collection: 'Involvement',
via : 'user'
}
}
};
我的事件类(class):
module.exports = {
attributes: {
creator: {
model: 'User'
},
involvements: {
collection: 'Involvement',
via: 'event'
}
}
};
我的参与类(class):
module.exports = {
attributes: {
status: {
type: 'string',
required: true
},
user : {
model : 'User'
},
event : {
model : 'Event'
}
}
};
当我尝试启动服务器时出现此错误:
Trying to access a collection string that is not defined.
最佳答案
尝试将 Sails 更新到较新的版本。我在 Sails 0.11.0 上尝试过,效果很好,所以我猜测循环关系可能存在问题。
npm 更新 sails
或者如果它是全局安装的:
sudo npm update -g sails
关于node.js - 水线: Trying to access a collection string that is not defined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31574476/