Works with connection with options appropriate for a driver initialized using Acolyte for ReactiveMongo (should not be used with other driver instances).
Works with connection with options appropriate for a driver
initialized using Acolyte for ReactiveMongo
(should not be used with other driver instances).
Connection is closed after the result Future
is completed.
Driver manager parameter (see DriverManager)
Function applied to initialized connection
import reactivemongo.api.MongoConnection import acolyte.reactivemongo.AcolyteDSL // handler: ConnectionHandler val s: Future[String] = AcolyteDSL.withConnection(handler) { con => val c: MongoConnection = con "Result" }
Works with Mongo driver configured with Acolyte handlers.
Works with Mongo driver configured with Acolyte handlers.
Driver and associated resources are released
after the function f
the result Future
is completed.
Driver manager parameter (see DriverManager)
Function applied to initialized driver
// handler: ConnectionHandler val s: Future[String] = withDriver(handler) { d => val initedDriver: MongoDriver = d "Result" } val i: Future[Int] = withDriver(alreadyInitedDriver) { d => val unchangedDriver: MongoDriver = d 1 // Result }
Works with connection with options appropriate for a driver initialized using Acolyte for ReactiveMongo (should not be used with other driver instances).
Works with connection with options appropriate for a driver initialized using Acolyte for ReactiveMongo (should not be used with other driver instances).
Driver manager parameter (see DriverManager)
Function applied to initialized connection
import reactivemongo.api.MongoConnection import acolyte.reactivemongo.AcolyteDSL // handler: ConnectionHandler val s: Future[String] = AcolyteDSL.withFlatConnection(handler) { con => val c: MongoConnection = con Future.successful("Result") }
Works with Mongo driver configured with Acolyte handlers.
Works with Mongo driver configured with Acolyte handlers.
Driver and associated resources are released
after the function f
the result Future
is completed.
Driver manager parameter (see DriverManager)
Function applied to initialized driver (returning a future)
// handler: ConnectionHandler val s: Future[String] = withFlatDriver(handler) { d => val initedDriver: MongoDriver = d Future.successful("Result") } val i: Future[Int] = withFlatDriver(alreadyInitedDriver) { d => val unchangedDriver: MongoDriver = d Future(1 + 2) // Result }
Functions to work with driver.