How can I call a related model in Mongoose mapreduce How can I call a related model in Mongoose mapreduce mongoose mongoose

How can I call a related model in Mongoose mapreduce


map/reduce operates on one collection at a time. My suggestion would be:

  1. Map/Reduce over events and emit once for each date including the event ID and the venue ID (hopefully you have the venue Id in the events collection)
  2. Query the resulting collection ("occurrences") for all records that have a venue ID, query venues for that document, and then update the "occurrences" document with the denormalized venue information.