WithCollection
Functions to work with a Mongo collection (provided DB functions).
Value members
Concrete methods
Works with specified collection from MongoDB "acolyte"
resolved using given driver initialized with 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 specified collection from MongoDB "acolyte"
resolved using given driver initialized with 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.
- Value parameters:
- conParam
Connection manager parameter (see ConnectionManager)
- f
Function applied to resolved Mongo collection
import scala.concurrent.{ ExecutionContext, Future } import reactivemongo.api.AsyncDriver import acolyte.reactivemongo.{ AcolyteDSL, ConnectionManager } // handler: ConnectionHandler def s[T: ConnectionManager](handler: => T)( implicit ec: ExecutionContext, d: AsyncDriver): Future[String] = AcolyteDSL.withCollection(handler, "colName") { _ => "Result" }
- name
the name of the collection
- See also:
AcolyteDSL.withDB[A,B]
Works with specified collection from MongoDB "acolyte" resolved using given connection.
Works with specified collection from MongoDB "acolyte" resolved using given connection.
- Value parameters:
- con
Previously initialized connection
- f
Function applied to resolved Mongo collection
import scala.concurrent.{ ExecutionContext, Future } import reactivemongo.api.AsyncDriver import acolyte.reactivemongo.{ AcolyteDSL, ConnectionHandler } // handler: ConnectionHandler def s(handler: ConnectionHandler)( implicit ec: ExecutionContext, d: AsyncDriver): Future[String] = AcolyteDSL.withConnection(handler) { con => AcolyteDSL.withCollection(con, "colName") { _ => "Result" } }
- name
the name of the collection
- See also:
WithDriver.withDB[T]
Works with specified collection from MongoDB "acolyte" resolved using given Mongo DB.
Works with specified collection from MongoDB "acolyte" resolved using given Mongo DB.
- Value parameters:
- db
Previously resolved Mongo DB
- f
Function applied to resolved Mongo collection
import scala.concurrent.{ ExecutionContext, Future } import reactivemongo.api.AsyncDriver import acolyte.reactivemongo.{ AcolyteDSL, ConnectionHandler } def s(handler: ConnectionHandler)( implicit ec: ExecutionContext, d: AsyncDriver): Future[String] = AcolyteDSL.withDB(handler) { db => AcolyteDSL.withCollection(db, "colName") { _ => "Result" } }
- name
the name of the collection