【问题标题】:How to get database name from a connection?如何从连接中获取数据库名称?
【发布时间】:2017-01-24 18:25:05
【问题描述】:

使用驱动rethinkdbdash...

给定:

const rConnection = r.db('someDb').table('someTable')

如何从变量rConnection 中获取此连接使用的数据库名称表名称

【问题讨论】:

    标签: rethinkdb rethinkdbdash


    【解决方案1】:

    类似于我的回答 here,这是一个有效的丑陋解决方案(在 rethinkdb 上测试,而不是 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'
    

    【讨论】:

      猜你喜欢
      • 2014-03-29
      • 2012-05-20
      • 2010-10-23
      • 2016-08-16
      • 2011-10-30
      • 2016-02-29
      • 1970-01-01
      • 2018-10-12
      • 1970-01-01
      相关资源
      最近更新 更多