【发布时间】:2015-12-24 06:59:16
【问题描述】:
我正在尝试通过一个调用来更新hasOne 和belongsTo 模型,如下所示(顺便说一句,与create() 一起工作)其中user 是一个返回的实例:
user.update({
email: req.body.email,
Profile: {
name: req.body.name,
gender: req.body.gender,
location: req.body.location,
website: req.body.website,
}
}).then(function(user) { //foo });
但我这辈子什么都做不了。我可以轻松地调用user.Profile.update({}) 并仅更改配置文件模型以及user.update({}),但嵌套不起作用。要么该功能不存在,没有很好地记录,要么我需要使用类似于async.waterfall 的东西分别更新两者?
谢谢!
【问题讨论】:
标签: express orm sequelize.js