Merge Documents From Two Collections Together in MongoDb
The problem is I have a lot of documents in one collection and even a lot more documents in another collection. I want to merge those documents together but I don’t want to write a lot of code to merge those documents together. It also might take a lot of time to do it.
MongoDb comes with map/reduce which is a cool feature you can use to achieve something like this. If you don’t know what map/reduce is I wrote an article like this sometime ago.
Let’s say you have one collection with this document. Let’s say it’s products collection.</p>