Sequelize.js sequelize belongtomany为连接表添加值
如何为连接表添加值,并从多对多关系中选择属于媒体的标记 TypeError:media.addTags不是一个函数 应用程序 标签表Sequelize.js sequelize belongtomany为连接表添加值,sequelize.js,Sequelize.js,如何为连接表添加值,并从多对多关系中选择属于媒体的标记 TypeError:media.addTags不是一个函数 应用程序 标签表 id name 可标记表格 id tag_id tagable_id tagable_type 媒体模型 Media.belongsToMany(Tag, { through: { model: 'tagable', unique: false, scope: { tagable_
id
name
可标记表格
id
tag_id
tagable_id
tagable_type
媒体模型
Media.belongsToMany(Tag, {
through: {
model: 'tagable',
unique: false,
scope: {
tagable_type: 1
}
},
otherKey: 'tag_id',
foreignKey: 'tagable_id',
constraints: false,
});
Media.belongsToMany(Tag, {
through: {
model: 'tagable',
unique: false,
scope: {
tagable_type: 1
}
},
otherKey: 'tag_id',
foreignKey: 'tagable_id',
constraints: false,
});