An association to eager-load, given as the model, its alias, or a full IncludeOptions.
The model to include
Optional
Alias for the included model. Used as:
// With 'as' aliasUser.findAll({ include: [{ model: Post, as: 'myPosts' }]})// Result: { id: 1, name: 'John', myPosts: [...] }// Without 'as' - defaults to model nameUser.findAll({ include: [{ model: Post }]})// Result: { id: 1, name: 'John', Posts: [...] } Copy
// With 'as' aliasUser.findAll({ include: [{ model: Post, as: 'myPosts' }]})// Result: { id: 1, name: 'John', myPosts: [...] }// Without 'as' - defaults to model nameUser.findAll({ include: [{ model: Post }]})// Result: { id: 1, name: 'John', Posts: [...] }
An association to eager-load, given as the model, its alias, or a full IncludeOptions.