Mongo Database Query with "Use <database>"

Hi,

Is there any way to change the database database when using one single mongo connection?
I’ve the same mongo database structure per customer and I created a user in the database that has readAllDatabases role, however I cannot find a way to change the database. something like how you do it in mongo. i.e. "use "

Thanks

Not at the moment; but that could change. As you’ve noticed, Redash queries the Database Name from its data source configuration, which is required during the data source setup.

We would review a pull request to change this. But we shouldn’t break users’ existing queries if they upgrade. I’m envisioning a change where Database Name is no longer required during setup. But it must be part of the query text if it’s not supplied during setup.

This is the relevant line in the query runner. The _get_db() method needs refactored. Because right now the database name is determined before the query is even parsed. To make a use key-value-pair effective, the database name determination would need to be deferred until the query is run.