Skip to content

Instantly share code, notes, and snippets.

@p1nox
Created June 8, 2015 12:44
Show Gist options
  • Save p1nox/922c63675a31462ed03f to your computer and use it in GitHub Desktop.
Save p1nox/922c63675a31462ed03f to your computer and use it in GitHub Desktop.
RethinkDB queries
r.table("data").map(function(doc) {
    return r.object(doc("country"), true) // return { <country>: true}
}).reduce(function(left, right) {
    return left.merge(right)
}).keys() // return all the keys of the final document
  • Doesn't support uniqueness

http://stackoverflow.com/questions/17789123/how-to-create-unique-items-in-rethinkdb/17789284#17789284

var ids = [1,2,3];
r.table("person").getAll(r.args(ids)).run(connection, callback)
  • Examples:

http://blog.justonepixel.com/geek/2013/07/30/blog-example-with-thinky/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment