单个mongodb查询中的区别和非区别

时间:2016-02-15 11:06:34

标签: mongodb nosql

在mongodb中是否有办法运行类似的(MYSQL)查询:

SELECT COUNT(DISTINCT(first_name)), COUNT(first_name) FROM table1

感谢。

1 个答案:

答案 0 :(得分:1)

尝试:

db.col.find({}).count()
db.col.find({first_name: {$exists: true}}).count()
db.col.distinct('first_name').length
相关问题