MongoDb查看文档总数


 description

在mongodb中查看test集合总文档数量

 command

db.getCollection('test').aggregate([{$count:"result"}])

 parameter

aggregate :  使用聚合管道执行聚合操作
$count :   统计文档总数

 result

{
    "result" : 2
}

I hope to help every developer quickly find the commands they need. Of course, you can also add your own commonly used commands for easy searching.