0

I am trying to make a join between two tables. The command I'm running is:

r.table("userclientmap").eq_join("user_id", r.table("users"))

My 'user' table looks like this:

[
    {
        "email":  "nielsen.ruben@gmail.com"
        "password":  "$2a$10$nO4/KHYkKRcx3D8GYwMCVu.gtsWd1SWzWz27N.TdxqdD9bf.LBXI6"
    }
]

My 'userclientmap' table looks like this:

[
    {
        "client_id":  "3c0e6447-ab2f-401e-a09d-d84c32406fe2" ,
        "id":  "d6356002-9e51-4f82-afb7-49799f7b5ded" ,
        "user_id":  "nielsen.ruben@gmail.com"
    }
]

I am getting the following error when running my query from the administration console:

A query could not be executed.

r.table("userclientmap").eq_join("user_id", r.table("users"))

Error:

TypeError: Object function () {
    var args;
    args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
    if (args.length !== fun.length) {
      throw new err.RqlDriverError("Expected " + fun.length + " argument(s) but found " + args.length + ".");
    }
    return fun.apply(this, args);
  } has no method 'eq_join'

I don't really know where to go from here. My query looks exactly like the ones from the documentation on http://rethinkdb.com/docs/table-joins/

I'm running rethinkdb version 1.8.1-0ubuntu1~raring (GCC 4.7.3)

Eldamir
  • 9,888
  • 6
  • 52
  • 73

1 Answers1

7

The Data Explorer in the admin UI uses JavaScript, whereas the documentation for joins (http://rethinkdb.com/docs/table-joins/) uses Python examples. eqJoin is the JavaScript driver's equivalent of eq_join in Python.

You should use:

r.table('userclientmap').eqJoin('user_id', r.table('users'))

(see http://www.rethinkdb.com/api/#js:joins-eqJoin).

Michael Glukhovsky
  • 1,008
  • 7
  • 5
  • What an annoying mistake :P Why would those be different anyways? Thanks though :) – Eldamir Sep 09 '13 at 11:12
  • 2
    The drivers for each language follow the conventions of the native language (e.g. camel case for JS, underscores for Python)-- one of the beautiful things about RethinkDB is that the query language (ReQL) feels like it's writing native code rather than following one syntax across all languages (like SQL). However, the documentation obviously needs to be multi-language wherever possible-- I'll open an issue to improve the documentation in places like this (totally understandable error!) – Michael Glukhovsky Sep 09 '13 at 11:16