Mongo Query

13 views
Skip to first unread message

satyam chandel

unread,
Aug 9, 2016, 11:55:15 AM8/9/16
to mongodb-dev
Hi Team,

I have an SQL statement to get the number of record and the distinct number of rows(using column userid).

  • select count(1) as uni, count(distinct userid) as dis from table

I want to achieve this in MongoDB using Java. Is it possible to do in same Mongo query?

FYI, I am using mongoDB version 3.2.7 and Java driver version 3.2.2


Regards,
Reply all
Reply to author
Forward
0 new messages