Aborts the transaction associated with the current client session (since MongoDB 4.
Aborts the transaction associated with the current client session (since MongoDB 4.0), if any otherwise does nothing .
EXPERIMENTAL: API may change without notice.
The database reference with transaction aborted (but not session)
Commits the transaction associated with the current client session (since MongoDB 4.
Commits the transaction associated with the current client session (since MongoDB 4.0), if any otherwise does nothing .
EXPERIMENTAL: API may change without notice.
import scala.concurrent.ExecutionContext import reactivemongo.api.DefaultDB def commitIt(db: DefaultDB)(implicit ec: ExecutionContext) = db.commitTransaction(failIfNotStarted = true)
The database reference with transaction commited (but not session)
The reactivemongo.api.MongoConnection that will be used to query this database.
The reactivemongo.api.MongoConnection that will be used to query this database.
Ends (closes) the session associated with this database reference (since MongoDB 3.
Ends (closes) the session associated with this database reference (since MongoDB 3.6), if any otherwise does nothing .
EXPERIMENTAL: API may change without notice.
The database reference with session ended
A failover strategy for sending requests.
Kills (aborts) the session associated with this database reference (since MongoDB 3.
Kills (aborts) the session associated with this database reference (since MongoDB 3.6), if any otherwise does nothing .
EXPERIMENTAL: API may change without notice.
The database reference with session aborted
This database name.
Starts a new session (since MongoDB 3.
Starts a new session (since MongoDB 3.6).
EXPERIMENTAL: API may change without notice.
import scala.concurrent.ExecutionContext import reactivemongo.api.DefaultDB def startIt(db: DefaultDB)(implicit ec: ExecutionContext) = db.startSession(failIfAlreadyStarted = true)
if true fails if a session is already started
The database reference updated with a new session, if none is already started with the current reference.
Starts a transaction (since MongoDB 4.
Starts a transaction (since MongoDB 4.0), if none is already started with the current client session otherwise does nothing.
It fails if no session is previously started (see startSession
).
EXPERIMENTAL: API may change without notice.
import scala.concurrent.ExecutionContext import reactivemongo.api.{ DefaultDB, WriteConcern } def doIt(db: DefaultDB, aWriteConcern: Option[WriteConcern])( implicit ec: ExecutionContext) = db.startTransaction(aWriteConcern, failIfAlreadyStarted = true)
the write concern for the transaction operation
The database reference with transaction.
Aborts the transaction associated with the current client session (since MongoDB 4.
Aborts the transaction associated with the current client session (since MongoDB 4.0), if any otherwise does nothing .
EXPERIMENTAL: API may change without notice.
import scala.concurrent.ExecutionContext import reactivemongo.api.DefaultDB def equivalentTo(db: DefaultDB)(implicit ec: ExecutionContext) = db.abortTransaction(failIfNotStarted = false)
The database reference with transaction aborted (but not session)
Returns a reactivemongo.api.Collection reference from this database (alias for the collection method).
Returns a reactivemongo.api.Collection reference from this database (alias for the collection method).
the Collection type
the name of the collection to resolve
the failover strategy to override the default one
Authenticates the connection on this database.
Authenticates the connection on this database.
the name of the user
the user password
MongoConnection.authenticate
Returns a reactivemongo.api.Collection reference from this database.
Returns a reactivemongo.api.Collection reference from this database.
the Collection type
the name of the collection to resolve
the failover strategy to override the default one
import scala.concurrent.ExecutionContext import reactivemongo.api.DB def resoleColl(db: DB)(implicit ec: ExecutionContext) = db.collection("acoll")
Commits the transaction associated with the current client session (since MongoDB 4.
Commits the transaction associated with the current client session (since MongoDB 4.0), if any otherwise does nothing .
EXPERIMENTAL: API may change without notice.
import scala.concurrent.ExecutionContext import reactivemongo.api.DefaultDB def equivalentTo(db: DefaultDB)(implicit ec: ExecutionContext) = db.commitTransaction(failIfNotStarted = false)
The database reference with transaction commited (but not session)
Ends (closes) the session associated with this database reference (since MongoDB 3.
Ends (closes) the session associated with this database reference (since MongoDB 3.6), if any otherwise does nothing .
EXPERIMENTAL: API may change without notice.
import scala.concurrent.ExecutionContext import reactivemongo.api.DefaultDB def equivalentTo(db: DefaultDB)(implicit ec: ExecutionContext) = db.endSession(failIfNotStarted = false)
The database reference with session ended
Kills (aborts) the session associated with this database reference (since MongoDB 3.
Kills (aborts) the session associated with this database reference (since MongoDB 3.6), if any otherwise does nothing .
EXPERIMENTAL: API may change without notice.
import scala.concurrent.ExecutionContext import reactivemongo.api.DefaultDB def equivalentTo(db: DefaultDB)(implicit ec: ExecutionContext) = db.killSession(failIfNotStarted = false)
The database reference with session aborted
Starts a new session (since MongoDB 3.
Starts a new session (since MongoDB 3.6), does nothing if a session has already being started .
EXPERIMENTAL: API may change without notice.
import scala.concurrent.ExecutionContext import reactivemongo.api.DefaultDB def equivalentTo(db: DefaultDB)(implicit ec: ExecutionContext) = db.startSession(failIfAlreadyStarted = false)
The database reference updated with a new session
Starts a transaction (since MongoDB 4.
Starts a transaction (since MongoDB 4.0), if none is already started with the current client session otherwise does nothing.
It fails if no session is previously started (see startSession
).
EXPERIMENTAL: API may change without notice.
import scala.concurrent.ExecutionContext import reactivemongo.api.{ DefaultDB, WriteConcern } def equivalentTo(db: DefaultDB, aWriteConcern: Option[WriteConcern])( implicit ec: ExecutionContext) = db.startTransaction(aWriteConcern, failIfAlreadyStarted = false)
the write concern for the transaction operation
The database reference with transaction.
(dB: StringAdd).self
(dB: StringFormat).self
(Since version 0.19.4) Internal: will be made private
Returns the database of the given name on the same MongoConnection.
Returns the database of the given name on the same MongoConnection.
Returns the database of the given name on the same MongoConnection.
the name of the collection to resolve
the failover strategy to override the default one
(Since version 0.19.4) Use connection.database(name)
(dB: ArrowAssoc[DB]).x
(Since version 2.10.0) Use leftOfArrow
instead
(dB: Ensuring[DB]).x
(Since version 2.10.0) Use resultOfEnsuring
instead
The reference to a MongoDB database, obtained from a reactivemongo.api.MongoConnection.
You should consider the provided reactivemongo.api.DefaultDB implementation.