javascript - Write mongodb mapReduce result to a file -
i have collection in mongodb data in collection has following structure :
{userid = 1 (the id of user), key1 = value1 , key2 = value2, .... } i want write mongodb mapreduce functions put userid in map function , in reduce function need write ( key,value ) pairs in csv (?) file such :
key1,key2, key3,...
value1,value2,value3,..
value1,value2,value3,..
value1,value2,value3,..
how can mongodb
thanks
there no "file output" option.
the mongodb documentation has details on exporting data.
in particular, mongoexport allows export json or csv should legible other software.
if want modify data output, you'll have use client library , cursor through data while writing file.
Comments
Post a Comment