RE: Access to other collections from Map / Reduce functions. What you can do is use "volume" to enter the data m / r needs at runtime. NOTE. In scope, only the SIMPLE collection of objects is used. By simple, I mean the lack of attached documents.
scope = { People : [{ Name : 'bob', Color : 'blue'}, { Name : 'sally', Color: 'orange'}] }
The above assembly of objects works fine. In the m / r function, just reference People as a global variable, and you can iterate through your collection, etc.
scope = { People : [{ Name : 'bob', Color : { Favorite : 'blue'} }, { Name : 'sally', Color : { Favorite : 'orange' } }] }
The above will not work, depending on the driver you are using, you will receive a Range error and report that the maximum call size is exceeded or something like that. Bonding with simple objects in the area of coverage will remain simple.
source share