MongoDB分组统计:
db.getCollection('promotion_record_info').aggregate([
{$match:{"step" :"BUMP_REFUSE"}},
{$group : { _id : "$failureCode" , total : {$sum : 1}}}
])
db.getCollection('promotion_record_info').aggregate([
{$match:{"createTime":{$gte:ISODate('2020-11-24T18:30:00Z'),$lt:ISODate( '2020-11-26T16:00:00Z' )},"step" :"BUMP_REFUSE"}},
{$group : { _id : "$failureCode" , total : {$sum : 1}}}
])
MongoDB数目统计:
db.getCollection("loan_instruction")
.find({"channel_code":"haiercf","status":"PENDING","submit_time":{"$gt":ISODate("2019-09-04T16:00:00.000+0000")}},{"submit_time":1})
.count()