Skip to content

Instantly share code, notes, and snippets.

Created March 13, 2013 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/5152652 to your computer and use it in GitHub Desktop.
Save anonymous/5152652 to your computer and use it in GitHub Desktop.
MongoDB の MapReduce を Ruby の DSL で書くアイディア

MongoDB の MapReduce を Ruby の DSL で書くアイディア

DSL で MapReduce の定義を書いて、Mapper や Reducer 単体テストを RSpec で書けると便利だと思う。

collection 'activities'
query {'time': {'$gte': '2013-01-01', '$lt': '2013-02-01'}}
out {'merge': 'activities_mr_result'}
@@ map
function () {
// Mapper
}
@@ reduce
function (key, values) {
// Reducer
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment