Map减少两个差异。 Mongo DB的集合

时间:2017-11-02 08:31:59

标签: javascript mongodb mapreduce

我有两个集合如下:

db.sample.find()



   { "_id" : ObjectId("59e0904aad730d53a04e8ece"), "city" : "pune", "additionalSkill" : [ "SUPW", "maths", "science" ] }
   { "_id" : ObjectId("59e09094ad730d53a04e8ecf"), "city" : "pune", "additionalSkill" : [ "jsp", "big data", "java" ] }
   { "_id" : ObjectId("59f6b7d9098eb8776b751d01"), "city" : "Bangalore", "additionalSkill" : [ "hadoop", "hibernate", "swings" ] }
   { "_id" : ObjectId("59f6c1ac098eb8776b751d02"), "city" : "belgaum", "additionalSkill" : [ "java", "c#", "jsp" ] }




db.sample1.find()



   { "_id" : ObjectId("59e0971aad730d53a04e8ed0"), "city" : "Bangalore", "additionalSkill" : [ "CSE", "computer Sciences", "art" ] }
   { "_id" : ObjectId("59e09733ad730d53a04e8ed1"), "city" : "belgaum", "additionalSkill" : [ "craft", "AWS", "art" ] }




我需要对这两个集合执行Map-Reduce,因此key将是city并将所有内容保留为值。如果密钥匹配,则必须组合相应密钥的附加技能。

0 个答案:

没有答案