Sequelize 使用关联创建对象

Sequelize create object with associations

我正在尝试保存续集模型及其关联。所有关联都是一对一的。从数据库中检索具有关联的模型工作得很好,但插入它们是另一回事,文档只会让我更加困惑。

这是我的插入方法:

models
    .radcheck
    .create(user, {
        include: [{model: models.skraningar}, {model: models.radusergroup}, {model: models.radippool}]
        })
    .then(success, error);

我在文档和此处的 Whosebug 上看到了如此多的方法来执行此操作,none 到目前为止,其中的一些方法对我来说很有意义。有人愿意帮我解决问题吗?

我总是通过外键关联保存模型

例如

models.user.create({ name : 'test', usergroup_id : 1 });