ユーザー数やコメント数などの簡単な統計を表示するダッシュボードを作成したいと考えています。
次のようなものを使用してコレクションを数えています
User.count(function(err, num){
if (err)
userCount=-1;
else
userCount = num;
Comment.count(function(err, num){
if (err)
commentCount=-1;
else
commentCount = num;
SomethingElse.count(...)
})
})
これは少し醜いと思います。4カウントをネストせずにそれを行う他の方法はありますか?