attributes: {
username: {
type: 'email', // validated by the ORM
required: true
},
password: {
type: 'string',
required: true
},
profile: {
firstname: 'string',
lastname: 'string',
photo: 'string',
birthdate: 'date',
zipcode: 'integer'
},
followers: 'array',
followees: 'array',
blocked: 'array'
}
我目前注册用户,然后更新配置文件信息后注册。如何开始将配置文件数据添加到此模型?Sails.js - 如何更新嵌套模型
我在其他地方看过这个推送方法应该可以工作,但事实并非如此。我得到这个错误:类型错误:对象的翻译:有没有方法“推”
Users.findOne(req.session.user.id).done(function(error, user) {
user.profile.push({
firstname : first,
lastname : last,
zipcode: zip
})
user.save(function(error) {
console.log(error)
});
});
您正在使用哪个数据库? – colbydauph
我正在使用MongoDB – diskodave