SailsJs错误。 TypeError:无法读取未定义的属性'属性'

我正在使用sailsjs和mongodb。 我得到错误“TypeError:无法读取属性'未定义的属性”。

这是模型:

UserInterest.js

module.exports = { attributes: { id: { type: 'integer', primaryKey: true }, name: { type: 'string' }, profiles: { collection: 'UserProfile', via: 'interests'} } }; 

UserProfile.js

 module.exports = { attributes : { id : { type : 'string', autoIncrement : true, primaryKey : true }, createdAt : { type : 'datetime' }, updatedAt : { type : 'datetime' }, user : { model : 'User' }, sex : { type : 'integer' }, interests : { collection : "UserInterest", via : "profiles", dominant : true } //Other attributes here } }; 

我试图得到一个用户configuration文件加载这种方式:

 UserProfile.findOne({user : id}) .populate("interests") .exec(function(err, obj) { if (err) { cb(err, null); } else { cb(err, obj); } }); 

在填充函数中发生错误。 为什么发生这种情况?

经过这个问题苦苦挣扎后,我find了答案。 属性兴趣被重复,风帆有问题。 我消除了重复,留下集合的定义。