Dataview DQL to DataviewJS query

I am having troubles formulating the following Dataview query as a DataViewJS query. Could somebody please help? Thanks.

TABLE without id Productivity, length(rows) as Count
FROM #daily
Where Productivity != null
GROUP BY Productivity

This seems to do the trick:

let group = dv.pages("#daily").where(n => n.Productivity != null).groupBy(n => n.Productivity);
dv.table(["Productivity", "Count"], group.map(n => [n.key, n.rows.length]));