title: Node sequelize group
body: <p>Postgresql database. Table:</p>
  <pre><code>Name  | equalId
  
  name1 | 1
  name2 | 2
  name3 | 1
  name4 | 2
  name5 | 1
  </code></pre>
  <p>I want to get an array of objects sorted by equalId. Example:</p>
  <pre><code>[
    {equalId: 1, names: ['name1', 'name3', 'name5']},
    {equalId: 2, names: ['name2', 'name4']},
  ]
  </code></pre>
  <p>How do I do this with sequelize?</p>
  <p>I tried:</p>
  <pre class="lang-js prettyprint-override"><code>await db.name.findAll({
    where: { equalId: { $not: null } },
    attributes: ['equalId', 'name'],
    order: ['name'],
    group: ['equalId', 'name'],
    raw: true,
    logging: true,
  });
  </code></pre>
  <p>But the result is not correct.</p>