title: Joining through other models
body: <p>I have 4 models.  <code>Factory</code>, <code>Car</code>, <code>Driver</code> and <code>Config</code>.</p>
  
  <p><code>Factory</code>s have <code>Car</code>s. A <code>Config</code> belongs to both a <code>Factory</code> and a <code>Car</code>.  A <code>Driver</code> belongs to a <code>Car</code> only, but, due to that association, I want them to also belong to the <code>Factory</code>.</p>
  
  <p>Essentially, I want a query to find all <code>Config</code>s for a particular driver.  That is, <code>Config</code>s belonging to all <code>Car</code>s that the <code>Driver</code> drives, and all the <code>Factory</code>s that the <code>Driver</code> is related to through <code>Car</code>s.</p>
  
  <p>Here are how the relations are set up:</p>
  
  <pre><code>Factory.hasMany(Config);
  Factory.hasMany(Car);
  
  Car.belongsToMany(Driver, { through: 'CarDrivers' });
  Car.hasMany(Config);
  Car.belongsTo(Factory);
  
  Driver.belongsToMany(Car, { through: 'CarDrivers' });
  
  Config.belongsTo(Car);
  Config.belongsTo(Factory);
  </code></pre>
  
  <p>I want a query such that:</p>
  
  <pre><code>const configs = await Config.findAll({
    where: { relatedUserId: ?? },
  });
  </code></pre>