{"action":"created","issue":{"url":"https://api.github.com/repos/sequelize/sequelize/issues/3193","labels_url":"https://api.github.com/repos/sequelize/sequelize/issues/3193/labels{/name}","comments_url":"https://api.github.com/repos/sequelize/sequelize/issues/3193/comments","events_url":"https://api.github.com/repos/sequelize/sequelize/issues/3193/events","html_url":"https://github.com/sequelize/sequelize/issues/3193","id":58477816,"number":3193,"title":"Support `Model.find({ ..., include: [ { as: 'fooBar' } ] })` and `Model.find({ ..., include: [ 'fooBar' ] })`","user":{"login":"dantman","id":53399,"avatar_url":"https://avatars.githubusercontent.com/u/53399?v=3","gravatar_id":"","url":"https://api.github.com/users/dantman","html_url":"https://github.com/dantman","followers_url":"https://api.github.com/users/dantman/followers","following_url":"https://api.github.com/users/dantman/following{/other_user}","gists_url":"https://api.github.com/users/dantman/gists{/gist_id}","starred_url":"https://api.github.com/users/dantman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dantman/subscriptions","organizations_url":"https://api.github.com/users/dantman/orgs","repos_url":"https://api.github.com/users/dantman/repos","events_url":"https://api.github.com/users/dantman/events{/privacy}","received_events_url":"https://api.github.com/users/dantman/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/sequelize/sequelize/labels/discussion","name":"discussion","color":"d4c5f9"},{"url":"https://api.github.com/repos/sequelize/sequelize/labels/feature","name":"feature","color":"0b02e1"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-02-21T22:26:12Z","updated_at":"2015-10-02T06:23:53Z","closed_at":null,"body":"`include` on model queries is fairly verbose in its current state.\r\n```js\r\nModel.find({ ..., include: [ { model: FooModel, as: 'fooBar' } ] });\r\nModel.find({ ..., include: [ { association: Model.associations.fooBar } ] });\r\n```\r\n\r\nAll of my models use `as`, because I have things like `UserEmail` as `user.emails`/`user.getEmails`, `UserPreference` as `user.preferencePairs`/`user.getPreferencePairs`, `UserAvatar` as `user.avatar`/`user.getAvatar`, etc. So using include is very verbose for me.\r\n\r\nFrom what I understand models already contain all the information they need about their associations. You can't associate multiple models to the same `as` name or property (`{ model: Bar, as: 'foo' }` and `{ model: Baz, as: 'foo' }` should be impossible on one model). And using an association from a different model has no meaning and just breaks the query.\r\n\r\nSo it doesn't sound like both `modal` and `as` or a whole `association` object is needed to do an include.\r\n\r\nSo I'd like to suggest we also support these formats for doing an include:\r\n```js\r\nModel.find({ ..., include: [ { as: 'fooBar' } ] });\r\nModel.find({ ..., include: [ 'fooBar' ] });\r\n```\r\n\r\nI think this actually makes a lot of sense.\r\n\r\nImplementation wise `Model` already knows that an association to the `fooBar` property exists and that the model for it is `FooModel`.\r\n\r\nUser expectation wise. The `as: 'fooBar'` association maps to the `fooBar` property. And so when you're writing `Model.find({ ..., include: [ 'fooBar' ] })` and then using `model.fooBar` it reads perfectly as `Find a Model instance and include the value of the 'fooBar' property from the associated model`."},"comment":{"url":"https://api.github.com/repos/sequelize/sequelize/issues/comments/144934996","html_url":"https://github.com/sequelize/sequelize/issues/3193#issuecomment-144934996","issue_url":"https://api.github.com/repos/sequelize/sequelize/issues/3193","id":144934996,"user":{"login":"mickhansen","id":699049,"avatar_url":"https://avatars.githubusercontent.com/u/699049?v=3","gravatar_id":"","url":"https://api.github.com/users/mickhansen","html_url":"https://github.com/mickhansen","followers_url":"https://api.github.com/users/mickhansen/followers","following_url":"https://api.github.com/users/mickhansen/following{/other_user}","gists_url":"https://api.github.com/users/mickhansen/gists{/gist_id}","starred_url":"https://api.github.com/users/mickhansen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mickhansen/subscriptions","organizations_url":"https://api.github.com/users/mickhansen/orgs","repos_url":"https://api.github.com/users/mickhansen/repos","events_url":"https://api.github.com/users/mickhansen/events{/privacy}","received_events_url":"https://api.github.com/users/mickhansen/received_events","type":"User","site_admin":false},"created_at":"2015-10-02T06:23:53Z","updated_at":"2015-10-02T06:23:53Z","body":"@irond13 we used to have quite a big of magic around naming that confused a ton of users, this has mostly been removed now so it could be worth revisiting."}}