Sequelize: Query same join table with different conditions
I have two models Contact and Thread with a many to many relationship represented across a join table ThreadContacts . I need to write a query to find a Thread which has associations with an exact list of Contacts . For example, I might have a list of contact_id 's [1,2,3,4], and I need to find a Thread that is associated with these exact 4 contacts. I have tried including Contact on a findAll query: Thread.findOne({ include: [{ model: Contact, where: { id: $in: [1, 2, 3, 4] }, }], }) Of course this doesn't work because it'll return a thread that has a ThreadContact with any of the 4 ids. I