Sequelize - 如何在目标belongsToMany关联上获取源id数组

时间:2017-08-24 14:58:15

标签: javascript mysql associations sequelize.js has-and-belongs-to-many

假设我有Student模型和Class模型,并且

Student.belongsToMany(Class, through: {StudentClasses})

在数据库中,StudenClasses表格包含idstudent_idclass_id,并且id喜欢拥有{{1}的所有关联student_id 1}}该表的实例

我如何在Class模型上包含一个包含所有相关Class ID的数组?

我已经挣扎了好几天了,任何帮助都会非常感激!

0 个答案:

没有答案