title: Sequelize many-to-many association - Method not found
body: <p>I have two n:m sequelize models as shown below</p>
  
  <pre><code>// Organization Model
  
  module.exports = {
  
      attributes: {
          id: {
              type: Sequelize.INTEGER,
              primaryKey: true,
              autoIncrement: true
          },
          name: {
              type: Sequelize.STRING,
              required: true
          },
      },
      associations: function() {
  
          Organization.belongsToMany(Contact, {
              through : OrganizationContact,
              foreignKey: {
                  name: 'organizationId',
                  allowNull: false
              }
          });
  
      }
  };
  
  // OrganizationContact Model
  
  module.exports = {
  
      attributes: {
          id: {
              type: Sequelize.INTEGER,
              primaryKey: true,
              autoIncrement: true
          }
      }
  }
  
  
  
  // Contact Model
  
  module.exports = {
  
      attributes: {
          id: {
              type: Sequelize.INTEGER,
              primaryKey: true,
              autoIncrement: true
          },
          firstname: {
              type: Sequelize.STRING,
              required: true
          },
          lastname: {
              type: Sequelize.STRING,
              required: false
          },
      },
      associations: function() {
  
          Contact.belongsToMany(Organization, {
              through : OrganizationContact,
              foreignKey: {
                  name: 'contactId',
                  allowNull: false
              }
          });
  
      }
  };
  </code></pre>
  
  <p>I am trying to insert a contact and attach it to an existing organization. My data looks like</p>
  
  <pre><code>{
      "firstname" : "Mathew",
      "lastname" : "Brown",
      "organizationId" : 1 // Add the contact to an existing organization. I am missing something here.
  }
  </code></pre>
  
  <p><strong>Note : There can be multiple contacts attached to multiple organizations. An organization is created before a contact.</strong></p>
  
  <p>Based on <a href="http://docs.sequelizejs.com/en/1.7.0/docs/associations/#many-to-many-associations" rel="nofollow noreferrer">this</a> documentation, after saving the contact when I tried </p>
  
  <pre><code>Organization.addContact(contact); 
  </code></pre>
  
  <p>I get an exception saying </p>
  
  <pre><code>Organization.addContact is not a function
  </code></pre>