sequelize.js - 如何通过嵌套元素属性查找所有项目?

sequelize.js - how to find all items by nested elements attribute?

我有两个表,'places' & 'photos'。 每个地方都有很多照片,每张照片都有一个属性叫做user_id。

我怎样才能找到所有有特定 user_id 照片的地方?

你可以在 sequelize

中使用 includes 选项
places.findAll({ include: [{ models : photos , where : { user_id = xx} }] })

或者您可以使用原始查询