I run a map reduce (through PHP) on a collection that provides the following data struture:
[_id : {Name ; order_amount} , Value : { timestamp ; price}]
for instance
[ _id : {Joe; #45}, Value : {150155155; 53$}]
[ _id : {Tom; #46}, Value : {150155155; 63$}]
[ _id : {Marie; #45}, Value : {150155155; 73$}]
[ _id : {Joe; #46}, Value : {150155158; 53$}]
[ _id : {Tom; #47}, Value : {150155158; 73$}]
I would like to re organize the output of those map-reduce results to get the following data structure :
[_id : {Timestamp} , Name1 : { order_amount ; price} , Name2 : { order_amount ; price} etc...]
In the example described above, that would give the following collection:
[_id : {150155155} , Joe { #45 ; 53$} , Tom { #46 ; 63$} , Marie { #45 ; 73$}]
[_id : {150155158} , Joe { #46 ; 53$} , Tom { #47 ; 73$}]