Reputation: 2631
I have two collections : one with the raw data from devices, one with the device configuration
I use map reduce to treat the raw data from devices. I need to get the configuration parameters inside the reduce step.
Is it possible ?
Thanks in advance
UPDATE : I have a lot of data to treat 400000 documents per day and around 4000 configuration documents. Thus I have to make a join between the two collections and inject that in map/reduce ? Is this the best way to do ?
Upvotes: 0
Views: 587
Reputation: 18595
No. Map/reduce should always use the collection data it is invoked on. If you need the configuration data you will have to make sure it is inside your raw device data before invoking the map/reduce. Since m/r is just JavaScript being executed server-side so it is technically possible to query other collections but it can break (sharding comes to mind).
Upvotes: 4