Skip to content
Advertisement

Sequelize – Include based on specific attribute

I have a model defined as follows:

I’m trying to use Sequelize to load all game object and include the User with the id equal to the playerId field.

The problem is I have two attributes (leaderId, playerId) which reference the User model so using include as follows does not work:

Is there a way to specify which attribute the include command should use?

Advertisement

Answer

https://github.com/nkhs/node-sequelize

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement