I have gone through several articles and examples, and have yet to find an efficient way to do this SQL query in MongoDB (where there are millions of rows documen
Following solution worked for me
db.test.distinct('user'); [ "alex", "England", "France", "Australia" ] db.countries.distinct('country').length 4
db.test.distinct('user'); [ "alex", "England", "France", "Australia" ]
db.countries.distinct('country').length 4