Distinct count with sequelize
<p>I'm trying to get a distinct count with sequelize such as</p>

<pre><code>'SELECT COUNT(DISTINCT(age)) AS `count` FROM `Persons` AS `Person`'
</code></pre>

<p>As long as I use a raw query, I get the desired result. However, as soon as I change to the sequelize count function, the query is broke in Postgres:</p>

<pre><code>Person.count({distinct:'age'}).then(...);
</code></pre>

<p>results to</p>

<pre><code>'SELECT COUNT(DISTINCT(*)) AS `count` FROM `Persons` AS `Person`'
</code></pre>

<p>which leads to a syntax error. Solutions described in different posts such as <a href="https://stackoverflow.com/questions/22643263/how-to-get-a-distinct-count-with-sequelize">How to get a distinct count with sequelize?</a> do not work, unless you add an include statement or a where clause which I do not have in this special case.</p>

<p>Does anybody know a proper solution for this?</p>