如何更新相关表belongsToMany Sequelize

时间:2019-03-09 21:02:49

标签: javascript sequelize.js

如何更新相关表中的值(标题)(属于ToMany)续集:模型类别,模型标签。我想更改字段的值,但是我不知道该怎么做。

    Post.update({
        title: 'Hello',

        tag: [{
            title: 'Show',
        }],

        category: [{
            title: 'Video'
        }),
    }, {
        where: {
            id: req.params.id
        }
    }, {
        include: [{
            model: Tag,
            as: 'tag'
        }, {
            model: Category,
            as: 'category'
        }],
    }).then(article => {

    })

0 个答案:

没有答案
相关问题