Is it possible to filter a query by the attributes in the association table with sequelize?

前端 未结 2 401
渐次进展
渐次进展 2020-12-24 08:24

I am trying to filter my query by the attributes of the joining table

I have 2 tables Cities and Categories which I am associating through a third table CityCategory

2条回答
  •  醉梦人生
    2020-12-24 08:58

    For Sequelize v3 it appears the syntax is closer to what you suggested, that is:

    include: [{
      model: Category,
      where: {year: 2015},
      attributes: ['id']
    }]
    

提交回复
热议问题