javascript - Sequelize: BelongsToMany error: <table> (alias) is not associated to <table> -


i can't seem figure 1 out. i've set belongstomany associations "as" value , still, error:

error: "user" (savers) not associated "link"

i have 2 models:

var user = sequelize.define("user", {...}); var link = sequelize.define("link", {...}); 

and following associations:

link.belongsto(user, {as: 'original_saver'}); link.belongstomany(user, {through: save, as: 'saves'}); user.belongstomany(link, {through: save, as: 'savers'}); 

the query i'm trying working following:

models.link.findall({     include: [         {model: models.user, as: 'savers'},         {model: models.user, as: 'original_saver'}     ] }) 

what doing wrong here?


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -