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.