Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

m- m sequelize

User.belongsToMany(Bar, { through: UserPubCrawl });
Bar.belongsToMany(User, { through: UserPubCrawl });

User.findAll({
  where: { user_id: '123' },
  include: {
    model: Bars,
    through: { attributes: [] } // this will remove the rows from the join table (i.e. 'UserPubCrawl table') in the result set
  }
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sequelize
ADD COMMENT
Topic
Name
8+5 =