Open kingschan1204 opened 5 years ago
db.task.group( { key: { PotNo: true,jhrw_rwlx:true}, //字段 initial: {count: 0}, reduce: function(obj,prev){ prev.count++;}, } )
Document doc= mongoTemplate.executeCommand("{'group' : {'ns' : 'task','key' : {'PotNo': true,'jhrw_rwlx':true},'initial' : {'count' : 0},'$reduce' : 'function(doc,prev){prev.count++;}'}}");
后者直接写jsoncommand