Mongodb常用命令、常见问题处理及设置
![](http://xpbag.com/wp-content/uploads/2020/08/1596805278-1a785dbb9ad6943.png)
1. mongodb去重计数
--方法一(容易内存不足报错,加allowDiskUse:true后会出现but there are no result to show)
db.reception.aggregate([
{limit:100000},
{group:{_id:"customer_info.customer_name"}},
{group:{_id:null,count:{sum:1}}}
])
--方法二
db.reception.aggregate([
{group:{_id:"customer_info.customer_name"}},
{count:"total_count"}
],{allowDiskUse:true})