title: Sequelize Association getting data like JSON
body: <p>I have simplified my problem with two tables as coconut and coconut_lists. Coconut table stores the specifications of coconut and coconut_lists store which seller has the coconut. For each time, a relation is created between seller and coconut it's inserted into coconut_lists table.  </p>
  
  <p>I have tried to use through keyword with attributes, setting different relations HasMany, HasOne, BelongsToMany. </p>
  
  <p>Coconut_List</p>
  
  <pre><code>import { Column, DataType, Model, Table, ForeignKey, BelongsTo } from 'sequelize-typescript';
  import Coconut from './coconut';
  
  
  @Table({
    modelName: 'cononuts_list',
    timestamps: true,
    paranoid: true,
  })
  export default class CoconutList extends Model&lt;CoconutList&gt; {
    @Column({
      allowNull: false,
      primaryKey: true,
      autoIncrement: true,
      type: DataType.INTEGER,
    })
    public id: number;
  
    @Column({
      type: DataType.STRING,
      allowNull: false,
    })
    public sellerId: string;
  
    @ForeignKey(() =&gt; coconut)
    @Column({
      type: DataType.INTEGER,
      allowNull: false,
    })
    public coconutId: number;
  
    @BelongsTo(() =&gt; Coconut, 'coconutId')
    public coconut: Coconut;
  
  
  }
  
  </code></pre>
  
  <p>Coconut</p>
  
  <pre><code>import { Column, DataType, Model, Table, HasMany } from 'sequelize-typescript';
  import CoconutList from './coconutList';
  
  
  @Table({
    modelName: 'coconuts',
    timestamps: true,
    paranoid: true,
  })
  export default class Coconut extends Model&lt;Coconut&gt; {
    @Column({
      allowNull: false,
      primaryKey: true,
      autoIncrement: true,
      type: DataType.INTEGER,
    })
    public id: number;
  
    @HasMany(() =&gt; CoconutList, 'id')
    public coconutList: CoconutList[];
  
    @Column({
      type: DataType.INTEGER,
      allowNull: false,
    })
    public weight: number;
  
    @Column({
      type: DataType.INTEGER,
      allowNull: false,
    })
    public count: number;
  
    @Column({
      type: DataType.FLOAT,
      allowNull: false,
    })
    public size: number;
  }
  
  </code></pre>
  
  <p>The query : </p>
  
  <pre><code>const coconutsBySeller = await CoconutList.findAll({
      include: [
        {
          model: Coconut,
          attributes: ['weight', 'size', 'count'],
        },
      ],
      attributes: ['sellerId'],
    });
  </code></pre>
  
  <p>Output of code is as follows : </p>
  
  <pre><code>[
    {
      "sellerId": "f3ff90d8-ed8e-42c9-9c7b-d607111a359e",
      "coconut": {
        "weight": 100,
        "count": 6,
        "size": 11,
      }
    },
    {
      "sellerId": "f3ff90d8-ed8e-42c9-9c7b-d607111a359e",
      "coconut": {
        "weight": 200,
        "count": 12,
        "size": 20,
      }
    },
    {
      "sellerId": "ffffaaaa-ed8e-42c9-9c7b-d607111a359e",
      "coconut": {
        "weight": 300,
        "count": 18,
        "size": 50,
      }
    },
    {
      "sellerId": "ffffaaaa-ed8e-42c9-9c7b-d607111a359e",
      "coconut": {
        "weight": 100,
        "count": 6,
        "size": 11,
      }
    }
  ]
  
  </code></pre>
  
  <p>Instead I want to get </p>
  
  <pre><code>[
    {
      "sellerId": "f3ff90d8-ed8e-42c9-9c7b-d607111a359e",
      [{
        "weight": 100,
        "count": 6,
        "size": 11,
      },
      {
        "weight": 200,
        "count": 12,
        "size": 20,
      }]
    },
    {
      "sellerId": "ffffaaaa-ed8e-42c9-9c7b-d607111a359e",
      [{
        "weight": 300,
        "count": 18,
        "size": 50,
  },   
      {
        "weight": 100,
        "count": 6,
        "size": 11,
      }
    ]
  ]
  </code></pre>
  
  <p>In addition to the format of data, I also wonder if it's possible to get min_max values of the weight, count, size fields of coconuts assigned to the seller using Sequelize within the above query.</p>