title: Return object instead of an Array of one object in Sequelize
body: <p><em>Been looking for similar questions without success.</em> I currently have an Angular app and a NodeJS/Express server and using Sequelize for MariaDB.</p>
  
  <p>I have a table I want to collect stats from and return as an simple object.</p>
  
  <pre><code>getPlayerStats = function(callback) {
    Player.findAll({
      attributes: [
        [sequelize.fn('sum', sequelize.col('points')), 'totalPointsEarned'],
        [sequelize.fn('count', sequelize.col('id')), 'totalPlayers'],
        [sequelize.fn('sum', sequelize.col('online')), 'totalOnline']
      ]
    }).then(playerStats =&gt; callback(playerStats));
  };
  </code></pre>
  
  <p>'</p>
  
  <pre><code>  app.get("/info/player-stats", function(request, response) {
      sql.getPlayerStats(result =&gt; response.send(result));
    });
  </code></pre>
  
  <p>This gives me the following output:</p>
  
  <pre><code>[
      {
          "totalPointsEarned": 457,
          "totalPlayers": 5,
          "totalOnline": 2
      }
  ]
  </code></pre>
  
  <p>This is causing issues when displaying the data in DOM, if I handle it as an object Angular won't display anything. If I handle it as an array with <code>*ngFor='let player of players'</code> it will display the data in DOM but gives me an error exception:</p>
  
  <p><code>ERROR Error: Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays</code></p>
  
  <p><strong>If</strong> I receive the following output: {}</p>
  
  <pre><code>{
      "totalPointsEarned": 457,
      "totalPlayers": 5,
      "totalOnline": 2
  }
  </code></pre>
  
  <p>.. instead of [{}] I believe it will be easier for me to display the data in DOM.</p>
  
  <p>I believe I will be in need to change something about the first batch of code posted here (Sequelize part) to get a single object in return instead of an array with only one object. Any advice or suggestions are more than welcome.</p>
  
  <p>Thanks in advance,
  Svante</p>