Reputation: 5516
If I have:
var Game = Sequelize.define('game');
var Move = Sequelize.define('move');
Move.belongsTo(Game);
How do I get a set of games with all moves? It seems I can easily get all moves with games:
Move.findAll({include: Game});
But not the other way around?
Game.findAll({include: Move});
Gives me Unhandled rejection Error: Move (move) is not associated to game!
.
Upvotes: 1
Views: 2293
Reputation: 28778
You need to provide the association both ways
Game.hasMany(Move);
Upvotes: 3