db.test.aggregate( {'$match':{"url":/http:\/\/www.baidu.cn\/member\/T107581\//}}, {'$group':{'_id':'$ip','count':{'$sum':1}}}, {'$skip':100}, {'$out':'201702'} )
如果需要查看返回分组的数量时,可以用一个变量去接收,然后打印长度。
var rel= db.hyyy.aggregate( {'$match':{"_id":{$gt:ObjectId("560c07000000000000000000"),$lt:ObjectId("5634e5800000000000000000")}}}, {'$group':{'_id':'$ip','count':{'$sum':1}}} //,{'$limit':10000} //,{'$skip':4000} //,{'$out':'201702'} ) print(rel.toArray().length);