7 ms·
Do you really need to write the map and reduce functions as a Javascript and supply them as strings? That certainly seems un-pythonic to me.
by baltcode 16y ago
Do you really need to write the map and reduce functions as a Javascript and supply them as strings? That certainly seems un-pythonic to me.
- grourk 16y agoIf you have m-r code in your application, codify those functions, store them separately in a directory or even Riak objects, and refer to them by name in your code. Or, better yet, write it in Erlang.
- baltcode 16y agoBy codify, do you mean something of this flavor: mapper = lambda x: (x['word'],1) Or something of the the following flavor: mapper = JSCode('function(x) {return (x.word,1)}')
- igorgue 16y agoNot to change the conversation but that's the same way you do it in PyMongo[1], I agree it looks bit un-pythonic. [1] http://api.mongodb.org/python/1.9%2B/examples/map_reduce.html http://api.mongodb.org/python/1.9%2B/examples/map_reduce.htm...