I have a collection in MongoDb where data in the collection has the following structure :
{userid = 1 (the id of the user), key1 = value1 , key2 = value2, .... }
I want to write mongodb mapreduce functions where i could put the userid in the map function and in the reduce function i need to write they ( key,value ) pairs in a csv (?) file such that they would be :
key1,key2, key3,...
value1,value2,value3,..
value1,value2,value3,..
value1,value2,value3,..
How can i do that with mongodb
Thanks