Skip to content

Instantly share code, notes, and snippets.

@colwilson
Created October 19, 2011 13:11
Show Gist options
  • Save colwilson/1298241 to your computer and use it in GitHub Desktop.
Save colwilson/1298241 to your computer and use it in GitHub Desktop.
# now let's feed all the baskets into the MapReduce
# notice that you must convert the mapFunc and
# reduceFunc to strings or else they will not work
# the 'out' bit is described here http://www.mongodb.org/display/DOCS/MapReduce#MapReduce-Overview
Basket.collection.mapReduce mapFunc.toString(), reduceFunc.toString(), { out : "results" }, (err, val) ->
if err
err # do something with the error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment