Hi,
I want to use mongo URI like mongodb://localhost:27017/db_name
to construct MongoConnection
object like it shown in docs
val driver = new MongoDriver MongoConnection.parseURI(uri) .map(parsedUri => driver.connection(parsedUri)).get
Is it possible to retrieve the DefaultDB
object out of the connection object without specifying db name explicitly as far as far as it already presented in the URI?
Something like:
val driver = new MongoDriver MongoConnection.parseURI(uri) .map(parsedUri => driver.connection(parsedUri)) .map(connection => connection.db()).get // as far as URI includes db name should be possible get the DB instance without specifying the name
Now I am doing it in that way:
val driver = new MongoDriver MongoConnection.parseURI(uri) .map(parsedUri => driver.connection(parsedUri)) .map(connection => connection.db("db_name")).get // db name provided explicitly