db.class.insert({class:1,student:1,subject :1,score:90 });
db.class.insert({class:1,student:1,subject :2,score:90 });
db.class.insert({class:1,student:1,subject :3,score:90 });
db.class.insert({class:1,student:2,subject :1,score:90 });
db.class.insert({class:1,student:2,subject :2,score:90 });
db.class.insert({class:1,student:2,subject :3,score:90 });
db.class.insert({class:2,student:1,subject :1,score:90 });
db.class.insert({class:2,student:1,subject :2,score:90 });
db.class.insert({class:2,student:1,subject :3,score:90 });
db.class.insert({class:2,student:2,subject :1,score:90 });
db.class.insert({class:2,student:2,subject :2,score:90 });
db.class.insert({class:2,student:2,subject :3,score:90 });
如何用mapreduce写每个班的每个科目的总分?
就是相当于sql中的
select class,subject,sum(score) from class group by class,subject;
mapreduce是不是只能求每个班的总分,或每个科目的总分呀?
就是
MapReduce
mongodb
|
|