title: SequelizeJS - hasMany to hasMany on the same table with a join table
body: <p>My problem is quite simple:</p>
  
  <p>I got a table named <strong>users</strong>.
  Those users can have a lot of contacts. Those contacts are other users.</p>
  
  <p>So I have a table named <strong>userHasContacts</strong>, with the id of the owner (<strong>userID</strong>), and the id of the contact (<strong>contactID</strong>).<br>
  Both of those foreign keys are referencing <strong>users</strong> table.</p>
  
  <p>Here is my beautiful diagram:</p>
  
  <pre><code>              ----------------  
  ______________|____      ____|____
  | userHasContacts |      | users |
  -------------------      ---------
  | #userID         |      | id    |
  | #contactID      |      ---------
  -------------------          |
                |              |
                ----------------
  </code></pre>
  
  <p>In sequelize, in my logic, I would write:</p>
  
  <pre><code>Users.hasMany(Users, {foreignKey: 'userID', joinTableName: 'userHasContacts'} );
  Users.hasMany(Users, {as: 'Contacts', foreignKey: 'contactID', joinTableName: 'userHasContacts'} );
  </code></pre>
  
  <p>But it seems like it doesn't work this way, and it's been 2 hours I am trying several ways to write this relation...</p>
  
  <p>The only line that worked for me was</p>
  
  <pre><code>Users.hasMany(UserHasContacts, {foreignKey: 'contactID', joinTableName: 'userHasContacts'} );
  
  UserHasContacts.findAndCountAll({ where: {userID: id} }).success( function(result) {        
      res.json(result);
  });
  </code></pre>
  
  <p>But then I cannot join <strong>users</strong> table in my find query (via <a href="http://sequelizejs.com/documentation#models-eager-loading" rel="noreferrer">Eager loading</a>) and it simply returns the data inside <strong>userHasContacts</strong>.</p>
  
  <p>If anyone got an hint, you are welcome!<br>
  Thanks by advance !</p>