[root@localhost scripts]# more find.js db.metric_pl.aggregate({$group: {_id: "$month", totalcnt: {$sum: 1}}}).forEach( function(c){print(c._id,"-->",c.totalcnt);} )
命令执行
/usr/local/services/mongodb/bin/mongo 192.168.1.135:28001/db_test find.js>>aa.txt