WithDB

acolyte.reactivemongo.WithDB
trait WithDB

Functions to work with MongoDB (provided driver functions).

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object AcolyteDSL.type
Self type

Members list

Concise view

Value members

Concrete methods

def withDB[A, B](conParam: => A)(f: DB => B)(implicit d: AsyncDriver, m: ConnectionManager[A], ec: ExecutionContext, compose: ComposeWithCompletion[B]): Outer

Works with a Mongo database (named "acolyte") resolved using given driver initialized using Acolyte for ReactiveMongo (should not be used with other driver instances). Driver and associated resources are released after the function f the result Future is completed.

Works with a Mongo database (named "acolyte") resolved using given driver initialized using Acolyte for ReactiveMongo (should not be used with other driver instances). Driver and associated resources are released after the function f the result Future is completed.

Attributes

conParam

the connection manager parameter (see ConnectionManager)

f

the function applied to initialized Mongo DB

import scala.concurrent.{ ExecutionContext, Future }
import reactivemongo.api.{ DB, AsyncDriver }
import acolyte.reactivemongo.{ AcolyteDSL, ConnectionHandler }
def s(handler: ConnectionHandler)(
 implicit ec: ExecutionContext, d: AsyncDriver): Future[String] =
 AcolyteDSL.withDB(handler) { (_: DB) =>
   "Result"
 }
See also:

AcolyteDSL.withConnection

def withDB[A, B](conParam: => A, name: String, setName: Option[String])(f: DB => B)(implicit d: AsyncDriver, m: ConnectionManager[A], ec: ExecutionContext, compose: ComposeWithCompletion[B]): Outer

Works with a Mongo database resolved using given driver initialized using Acolyte for ReactiveMongo (should not be used with other driver instances). Driver and associated resources are released after the function f the result Future is completed.

Works with a Mongo database resolved using given driver initialized using Acolyte for ReactiveMongo (should not be used with other driver instances). Driver and associated resources are released after the function f the result Future is completed.

Attributes

conParam

the connection manager parameter (see ConnectionManager)

f

the function applied to initialized Mongo DB

import scala.concurrent.{ ExecutionContext, Future }
import reactivemongo.api.{ DB, AsyncDriver }
import acolyte.reactivemongo.{ AcolyteDSL, ConnectionHandler }
def s(handler: ConnectionHandler)(
 implicit ec: ExecutionContext, d: AsyncDriver): Future[String] =
 AcolyteDSL.withDB(handler, "my_db") { (_: DB) =>
   "Result"
 }
name

the name of database

setName

the name of the replica set (if some)

See also:

AcolyteDSL.withConnection

def withDB[T](con: => MongoConnection)(f: DB => T)(implicit ec: ExecutionContext, compose: ComposeWithCompletion[T]): Outer

Works with Mongo database (named "acolyte") resolved using given driver initialized using Acolyte for ReactiveMongo (should not be used with other driver instances).

Works with Mongo database (named "acolyte") resolved using given driver initialized using Acolyte for ReactiveMongo (should not be used with other driver instances).

Attributes

con

a previously initialized connection

f

the function applied to initialized Mongo DB

import scala.concurrent.ExecutionContext
import reactivemongo.api.{ DB, AsyncDriver }
import acolyte.reactivemongo.{ AcolyteDSL, ConnectionHandler }
def s(handler: ConnectionHandler)(
 implicit ec: ExecutionContext, d: AsyncDriver) =
 AcolyteDSL.withConnection(handler) { con =>
   AcolyteDSL.withDB(con) { (_: DB) =>
     "Result"
   }
 }
See also:

AcolyteDSL.withConnection

def withDB[T](con: => MongoConnection, name: String)(f: DB => T)(implicit ec: ExecutionContext, compose: ComposeWithCompletion[T]): Outer

Works with a Mongo database resolved using given driver initialized using Acolyte for ReactiveMongo (should not be used with other driver instances).

Works with a Mongo database resolved using given driver initialized using Acolyte for ReactiveMongo (should not be used with other driver instances).

Attributes

con

a previously initialized connection

f

the function applied to initialized Mongo DB

import scala.concurrent.{ ExecutionContext, Future }
import reactivemongo.api.{ DB, AsyncDriver }
import acolyte.reactivemongo.{ AcolyteDSL, ConnectionHandler }
// handler: ConnectionHandler
def s(handler: ConnectionHandler)(
 implicit ec: ExecutionContext, d: AsyncDriver): Future[String] =
 AcolyteDSL.withConnection(handler) { con =>
   AcolyteDSL.withDB(con, "my_db") { (_: DB) =>
     "Result"
   }
 }
name

the name of database

See also:

AcolyteDSL.withConnection