Skip to content

Instantly share code, notes, and snippets.

@neumino
Created June 18, 2014 21:33
Show Gist options
  • Save neumino/455aa5b1cb8d8a732f5c to your computer and use it in GitHub Desktop.
Save neumino/455aa5b1cb8d8a732f5c to your computer and use it in GitHub Desktop.
Pivot example with r.object
r.db('test').table('marks')
.group('name')
.concatMap(function(row){return [row('course'), row('mark')];})
.ungroup()
.map(function(res){
return r.expr({name: res('group')})
.merge(r.object(r.args(res('reduction'))));
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment