ppvPlanDb.models.ppv_plans.findAll({
attributes: ['id', 'studio_id', 'status', 'is_advance_purchase','content_types_id' ],
where: sequelize.and(sequelize.where(sequelize.col('ppv_plans.status'), '=', 1,sequelize.col('ppv_plans.studio_id'), '=', studio_id,sequelize.col('ppv_plans.is_advance_purchase'), '=', 1,sequelize.col('ppv_plans.content_types_id'), '', (1,4))),
include: [{
model: ppvAdvanceContentDb.models.ppv_advance_content.findAll(),
required: false
}]
})
为什么在控制台中显示错误?有什么事吗我对如何将两个表进行序列化感到困惑。在这里,我试图连接两个表(ppv_plans和ppv_advance_content)。请告诉我。
答案 0 :(得分:0)
您不需要添加对 .findAll()
的调用,model
字段应该只是对关联模型的引用
参考:https://sequelize.org/master/manual/eager-loading.html#fetching-all-associated-elements