title: Nodejs Op sequelize multiple relationship
body: <p>I have 4 tables &quot;User&quot;, &quot;Teacher&quot;, &quot;Address&quot;, &quot;Subjects&quot; the User table have connection to Teacher table (userId field) and the Teacher table have connection to &quot;Address&quot;, and &quot;Subjects&quot; (teacherId)</p>
  <p>what I want is to map all users that has a data of teacher, address and subjects, my problem is I cant connect the address and subjects table to users</p>
  <p>this is my current code</p>
  <pre><code>async getUsersTeacherInfo(){
    let user = await Database.getConnection().models.User
    let teacher = await Database.getConnection().models.Teacher
    let address = await Database.getConnection().models.Address
    let subjects = await Database.getConnection().models.Subjects
    user.hasOne(teacher, { foreignKey: 'userId', sourceKey: '_id' })
    user.belongsTo(address, { foreignKey: 'teacherId', sourceKey: '_id' })
    user.belongsTo(subjects, { foreignKey: 'teacherId', sourceKey: '_id' })
    user = await Database.getConnection().models.User.findAll({
      attributes:[....,],
      include:[
          { model: Teacher, attributes: ['status', 'Teacher','_id'] },
          { model: Address, attributes: [....,], paranoid: false,   required: false},
          { model: Subjects, attributes: [....,], paranoid: false,   required: false},
      ]
  
    })
  
  }
  </code></pre>
  <p>I've tried also this</p>
  <pre><code>    async getUsersTeacherInfo(){
        let user = await Database.getConnection().models.User
        let teacher = await Database.getConnection().models.Teacher
        let address = await Database.getConnection().models.Address
        let subjects = await Database.getConnection().models.Subjects
        user.hasOne(teacher, { foreignKey: 'userId', sourceKey: '_id' })
        user.belongsTo(address, { foreignKey: 'teacherId', sourceKey: '_id' })
        user.belongsTo(subjects, { foreignKey: 'teacherId', sourceKey: '_id' })
        user = await Database.getConnection().models.User.findAll({
          attributes:[....,],
          include:[
              { model: Teacher, attributes: ['status', 'Teacher','_id'], 
  
                 include:[
                       { model: Address, attributes: [....,], paranoid: false,   required: false},
                      { model: Subjects, attributes: [....,], paranoid: false,   required: false},
  
             ]}
          ]
      
        })
      
      }
  </code></pre>