Using the driver rethinkdbdash...
Given:
const rConnection = r.db('someDb').table('someTable')
How do I get the database name or the table name this connection is using from the variable rConnection
?
Using the driver rethinkdbdash...
Given:
const rConnection = r.db('someDb').table('someTable')
How do I get the database name or the table name this connection is using from the variable rConnection
?
Similar to my answer here, here's an ugly solution that works (tested on rethinkdb, not rethinkdbdash):
nesh> let mom = (q, fn) => q.toString().match(new RegExp(fn + '\\(\\"(.*?)\\"\\)'))[1]
undefined
nesh> rql = r.db('foo').table('bar')
nesh> mom(rql, 'db')
'foo'
nesh> mom(rql, 'table')
'bar'