Closed genyded closed 7 years ago
@genyded you should be able to pass the db
optarg to .run()
.
But then doesn't that have to be done on each/every query? The whole point of specifying/changing the default
is to avoid having to do that. It's also likely we'll want to run the same query against 2 different targets - which I suppose we could do by passing it as a parameter, but then that parameter has to be passed on every call, which somewhat seems to defeat the whole purpose of abstracting.
Maybe I am missing something obvious, but I think that is why the use
call exists everywhere else in the first place.
@genyded you can instantiate rethinkdbdash
with db: 'foo'
, and foo
will be used as the default database across all connections in the pool. Then you can call .run({ db: 'bar' })
to change the default database on the fly. Does that answer your question?
If something like conn.use(db)
were supported, that would imply globally changing the default db across all connections in the pool, which is probably not what you want. It would be impossible to have any guarantee that a given query would be running against the intended db.
Yes it does and thanks for sticking with me and clarifying. Fairly new to all this and there are many moving parts!
reQL and the core driver can use something like
conn.use('marvel')
to change the default database on the fly. Does this driver have something comparable sinceuse
does not seem to work?