0

I have 2 collections as follows:

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" ] }

i need to perform Map-Reduce on both the collection so key will be city and rest the things to be values. If key matches it has to combine additional-Skills of respective key.

Nikilesh
  • 3
  • 6
  • Seems you are reading old material. `mapReduce` is not for "joins". There are other means of doing "joins". You are in fact asking for a LEFT JOIN. This is exactly what [`$lookup`](https://docs.mongodb.com/manual/reference/operator/aggregation/lookup/) does. – Neil Lunn Nov 02 '17 at 08:36
  • no its not the matter about LEFT JOIN you can achieve mapReduce for the above requirement – pooja patil Nov 02 '17 at 08:55

0 Answers0