{"action":"opened","issue":{"url":"https://api.github.com/repos/sequelize/sequelize/issues/9511","repository_url":"https://api.github.com/repos/sequelize/sequelize","labels_url":"https://api.github.com/repos/sequelize/sequelize/issues/9511/labels{/name}","comments_url":"https://api.github.com/repos/sequelize/sequelize/issues/9511/comments","events_url":"https://api.github.com/repos/sequelize/sequelize/issues/9511/events","html_url":"https://github.com/sequelize/sequelize/issues/9511","id":330131869,"node_id":"MDU6SXNzdWUzMzAxMzE4Njk=","number":9511,"title":"How to solve include data nesting ， i don't like the result in an object","user":{"login":"Chen-WeiZhen","id":18025841,"node_id":"MDQ6VXNlcjE4MDI1ODQx","avatar_url":"https://avatars1.githubusercontent.com/u/18025841?v=4","gravatar_id":"","url":"https://api.github.com/users/Chen-WeiZhen","html_url":"https://github.com/Chen-WeiZhen","followers_url":"https://api.github.com/users/Chen-WeiZhen/followers","following_url":"https://api.github.com/users/Chen-WeiZhen/following{/other_user}","gists_url":"https://api.github.com/users/Chen-WeiZhen/gists{/gist_id}","starred_url":"https://api.github.com/users/Chen-WeiZhen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Chen-WeiZhen/subscriptions","organizations_url":"https://api.github.com/users/Chen-WeiZhen/orgs","repos_url":"https://api.github.com/users/Chen-WeiZhen/repos","events_url":"https://api.github.com/users/Chen-WeiZhen/events{/privacy}","received_events_url":"https://api.github.com/users/Chen-WeiZhen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-07T06:19:47Z","updated_at":"2018-06-07T06:19:47Z","closed_at":null,"author_association":"NONE","body":"<!--\r\n\r\nPlease note this is an issue tracker, not a support forum.\r\nFor general questions, please use StackOverflow or Slack.\r\n\r\nFor bugs, please fill out the template below.\r\n\r\n-->\r\n\r\n## What are you doing?\r\n<!-- Post a minimal, self-contained code sample that reproduces the issue, including models and associations -->\r\n\r\n```js\r\nawait infoListModel.findAll({\r\n      include:[{\r\n        model:User,\r\n        attributes:{exclude:['updatedAt','unionId','createdAt','gender']}\r\n      },\r\n      {\r\n        model:Topic,\r\n        attributes:{exclude:['updatedAt','unionId','createdAt','gender']}\r\n      }\r\n]\r\n```\r\n\r\n## What do you expect to happen?\r\n```\r\n[{\r\n        \"infoId\": 3,\r\n        \"content\": \"我是第我是第一条数据我是第一条数据我是第一条数据我是第一条数据我是第一条数据我是第一条数据我是第一条数据一条数据\",\r\n        \"like_count\": 51,\r\n        \"post_count\": 0,\r\n        \"updatedAt\": \"2018-06-07T05:52:57.000Z\",\r\n\r\n        \"uid\": 1,\r\n        \"username\": \"陈韦臻\",\r\n        \"avatar\": \"https://wx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTIHmiadgySExiakKxsHobq70sxZDyic1BORkNqJ5nezISMeZoh1om6ysG53dbAoYjK0FetXV83O8icUiaw/132\"\r\n\r\n         \"topicId\": 3,\r\n         \"title\": \"失恋快乐\",\r\n         \"des\": \"失恋最好的方式就是投入下一段感情？谈何容易，你走出来了吗？\"\r\n        }\r\n    }]\r\n```\r\n\r\n## What is actually happening?\r\n```\r\n[{\r\n        \"infoId\": 3,\r\n        \"uid\": 1,\r\n        \"topicId\": 3,\r\n        \"content\": \"content content i am content\",\r\n        \"like_count\": 51,\r\n        \"post_count\": 0,\r\n        \"updatedAt\": \"2018-06-07T05:52:57.000Z\",\r\n        \"user\": {\r\n            \"uid\": 1,\r\n            \"username\": \"jshon\",\r\n            \"avatar\": \"https://wx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTIHmiadgySExiakKxsHobq70sxZDyic1BORkNqJ5nezISMeZoh1om6ysG53dbAoYjK0FetXV83O8icUiaw/132\"\r\n        },\r\n        \"topic\": {\r\n            \"topicId\": 3,\r\n            \"title\": \"make me headach\",\r\n            \"des\": \"description description description description \"\r\n        }\r\n    }]\r\n```\r\n\r\n_Output, either JSON or SQL_\r\n```\r\nSELECT\r\n\t`infoList`.`infoId`,\r\n\t`infoList`.`uid`,\r\n\t`infoList`.`topicId`,\r\n\t`infoList`.`content`,\r\n\t`infoList`.`like_count`,\r\n\t`infoList`.`post_count`,\r\n\t`infoList`.`updatedAt`,\r\n\t`user`.`unionId` AS `user.unionId`,\r\n\t`user`.`uid` AS `user.uid`,\r\n\t`user`.`username` AS `user.username`,\r\n\t`user`.`avatar` AS `user.avatar`,\r\n\t`topic`.`topicId` AS `topic.topicId`,\r\n\t`topic`.`title` AS `topic.title`,\r\n\t`topic`.`des` AS `topic.des` \r\nFROM\r\n\t`infoList` AS `infoList`\r\n\tLEFT OUTER JOIN `user` AS `user` ON `infoList`.`uid` = `user`.`uid`\r\n\tLEFT OUTER JOIN `topic` AS `topic` ON `infoList`.`topicId` = `topic`.`topicId` \r\nORDER BY\r\n\t`infoList`.`updatedAt` DESC;\r\n```\r\n\r\n__Dialect:__ mysql \r\n__Dialect version:__5.7.21\r\n__Sequelize version:__4.37.10\r\n__Tested with latest release:__ Yes\r\n\r\n\r\n**Note :** _Your issue may be ignored OR closed by maintainers if it's not tested against latest version OR does not follow issue template._\r\n"}}
{"actor":{"display_login":"Chen-WeiZhen"}}