Advertisement
Guest User

Untitled

a guest
Mar 7th, 2018
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // this should work for a belongsToMany relationship where DriverCar is the join table
  2. Driver.findOne({
  3.   where: {id: 10},
  4.   include: [{
  5.     model: Car
  6.   }]
  7. })
  8.  
  9. // this should work where Driver hasMany DriverCar and Car hasMany DriverCar
  10. Driver.findOne({
  11.   where: {id: 10},
  12.   include: [{
  13.     model: DriverCar,
  14.     include: [{
  15.       model: Car
  16.     }]
  17.   }]
  18. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement