Skip to content

Instantly share code, notes, and snippets.

@tlatsas
Last active August 29, 2015 14:22
Show Gist options
  • Save tlatsas/4f2de3e8c1a42d8daff1 to your computer and use it in GitHub Desktop.
Save tlatsas/4f2de3e8c1a42d8daff1 to your computer and use it in GitHub Desktop.
RethinkDB notes (Data Explorer)
// filter entries with empty 'field1'
r.db('db_name')
.table('test')
.filter(function(search){ return search.hasFields('field1').not() })
.count();
// return only rows that have 'field1' presesent
r.db('db_name')
.table('test')
.hasFields('field1')
.count();
// join two tables (test1 + test2) based on field equality (field1 is present on both tables)
r.db('db_name')
.table('test1')
.eqJoin('field1', r.db('db_name').table('test2'), {index: 'field1'})
.zip()
.pluck('field1', 'other_interesting_fields')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment