语法:

db.集合名称.distinct('去重字段',{条件})

 

例1:查找年龄大于18的性别(去重)

db.stu.distinct('gender',{age:{$gt:18}})