Title: Sequelize chain find with belongsTo
Tags: javascript;node.js;postgresql;sequelize.js
Question: I have three models, Discussion, User and Message, where:

```Message.belongsTo(models.Discussion, {as: 'discussion'})
Discussion.belongsToMany(models.User, {through: models.UserDiscussion})
```

I would like to get all messages concerning a specific user. From the user, I can easily get all the discussions with ```user.getDiscussions()```.
But then I don't know how to find the messages in a single request. Once I have the discussions array, I can call find

```models.Message.findAll({where: {discussionId: discussions[i].id}})
```

for every discussion in the array, but this is asynchronous and I don't know how to chain them, to return only the messages.

Is there no getter with a belongsTo relationship ?


Here is the accepted answer: Where you're searching for your user, you should be able to do something like:

```Discusson.findAll({ 
    // where query 
    },
    {
       include: [Message]
    })
    .then(function(user) {

    });
```



{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2016:00:03/02/16', 'FavoriteCount': 1.0, 'PostTypeId': 1, 'Tags': '<javascript><node.js><postgresql><sequelize.js>', 'Title': 'Sequelize chain find with belongsTo', 'ViewCount': 270, 'id': 35736713, 'user_AboutMe': '<p>Me</p>\n', 'user_AccountId': 4706431.0, 'user_DisplayName': 'jood', 'user_Reputation': 2052.0, 'user_Views': 73.0, 'user_id': 3808402.0}}