trait Transactions extends AnyRef
Effectively provides the behaviour not available on org.mongodb.scala.ClientSession (driver-scala, nor
com.mongodb.reactivestreams.client.ClientSession driver-reactive-streams) but is available on
com.mongodb.client.ClientSession (driver-core).
It is recommended to use the Future variant (i.e. add .toFuture to all db calls), since the Observable variant
has some surprises. E.g.
- some commands return
Observable[Void]which will ignore any following map/flatMap (e.g. for-comprehension steps) - exceptions are only propagated up if they occur inside an Observable, other exceptions (e.g. thrown in map/flatMap) will be be swallowed, leading to timeouts.
- Alphabetic
- By Inheritance
- Transactions
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
- abstract def mongoComponent: MongoComponent
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
completeWith[A](obs: Observable[Void], f: ⇒ A): Observable[A]
Observable[Void] by definition will never emit a value to be mapped (see org.mongodb.scala.internal.MapObservable).
Observable[Void] by definition will never emit a value to be mapped (see org.mongodb.scala.internal.MapObservable). When converting to Future, it works since it completes with
None(see org.mongodb.scala.Observable.headOption). This function converts an Observable[Void] to the provided value to continue. -
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
- def withClientSession[A](f: (ClientSession) ⇒ Observable[A])(implicit tc: TransactionConfiguration): Observable[A]
- def withClientSession[A](f: (ClientSession) ⇒ Future[A])(implicit tc: TransactionConfiguration, ec: ExecutionContext): Future[A]
- def withSessionAndTransaction[A](f: (ClientSession) ⇒ Observable[A])(implicit tc: TransactionConfiguration): Observable[A]
- def withSessionAndTransaction[A](f: (ClientSession) ⇒ Future[A])(implicit tc: TransactionConfiguration, ec: ExecutionContext): Future[A]
-
def
withTransaction[A](session: ClientSession, f: ⇒ Observable[A])(implicit tc: TransactionConfiguration): Observable[A]
A transaction is started before running the continuation.
A transaction is started before running the continuation. It will be committed or aborted depending on whether the callback executes successfully or not. It also provides retries for network issues See https://github.com/mongodb/mongo-java-driver/tree/r4.3.1/driver-core/src/test/resources/transactions-convenient-api#retry-timeout-is-enforced And https://docs.mongodb.com/manual/core/retryable-writes/#retryable-writes-and-multi-document-transactions
-
def
withTransaction[A](session: ClientSession, f: ⇒ Future[A])(implicit tc: TransactionConfiguration, ec: ExecutionContext): Future[A]
A transaction is started before running the continuation.
A transaction is started before running the continuation. It will be committed or aborted depending on whether the callback executes successfully or not. It also provides retries for network issues See https://github.com/mongodb/mongo-java-driver/tree/r4.3.1/driver-core/src/test/resources/transactions-convenient-api#retry-timeout-is-enforced And https://docs.mongodb.com/manual/core/retryable-writes/#retryable-writes-and-multi-document-transactions