Skip to content

Instantly share code, notes, and snippets.

@neumino
Created November 4, 2013 22:18
Show Gist options
  • Save neumino/7310162 to your computer and use it in GitHub Desktop.
Save neumino/7310162 to your computer and use it in GitHub Desktop.
r.db('test').table('test').map( function(doc) {
return r.expr(['id', 'value']).map( function(key) {
return r.expr([[key, r.expr([[doc(key).typeOf().default('UNDEFINED'), 1]]).coerceTo('OBJECT')]]).coerceTo('OBJECT')
}).reduce( function(left, right) {
return left.merge(right)
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment