Works with a MongoDB driver handling only queries,
using given query handler
.
Works with a MongoDB driver handling only queries,
using given query handler
.
Driver and associated resources are released
after the function f
the result Future
is completed.
Query handler
import scala.concurrent.ExecutionContext import reactivemongo.api.{ AsyncDriver, MongoConnection } import acolyte.reactivemongo.{ AcolyteDSL, PreparedResponse, Request } def aResponse: PreparedResponse = ??? def foo(implicit ec: ExecutionContext, d: AsyncDriver) = AcolyteDSL.withQueryHandler({ req: Request ⇒ aResponse }) { d => val con: MongoConnection = d "aResult" }
Works with a MongoDB driver handling only write operations,
using given write handler
.
Works with a MongoDB driver handling only write operations,
using given write handler
.
Driver and associated resources are released
after the function f
the result Future
is completed.
Writer handler
import scala.concurrent.ExecutionContext import reactivemongo.api.{ AsyncDriver, MongoConnection } import acolyte.reactivemongo.{ AcolyteDSL, PreparedResponse, Request, WriteOp } def aResp: PreparedResponse = ??? def foo(implicit ec: ExecutionContext, d: AsyncDriver) = AcolyteDSL.withWriteHandler({ (_: WriteOp, _: Request) ⇒ aResp }) { d => val con: MongoConnection = d "aResult" }
Functions to work with handler (provided driver functions).