Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a count in mongodb for approved users

I need count for a approved = true users on mongodb.

 Users.count #it showing total users count from db

I tried Users.count({:approved => true})

But it showing wrong number of arguments ( 1 for 0 )

Help me.

Thanks in advance.

like image 859
Dileep Kumar Avatar asked Oct 02 '22 07:10

Dileep Kumar


1 Answers

try

db.user.where({:approved => true}).count()
like image 182
user3415653 Avatar answered Oct 13 '22 12:10

user3415653