Package org.springframework.data.mongodb
Class ReactiveMongoDatabaseUtils
java.lang.Object
org.springframework.data.mongodb.ReactiveMongoDatabaseUtils
Helper class for managing reactive 
Note: Intended for internal usage only.
MongoDatabase instances via ReactiveMongoDatabaseFactory. Used for
 obtaining session bound resources, such as MongoDatabase and MongoCollection
 suitable for transactional usage.
 Note: Intended for internal usage only.
- Since:
- 2.2
- Author:
- Mark Paluch, Christoph Strobl, Mathieu Ouellet
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic Mono<com.mongodb.reactivestreams.client.MongoDatabase>getDatabase(String dbName, ReactiveMongoDatabaseFactory factory) static Mono<com.mongodb.reactivestreams.client.MongoDatabase>getDatabase(String dbName, ReactiveMongoDatabaseFactory factory, SessionSynchronization sessionSynchronization) Obtain thedatabasewith given name form the givenfactory.static Mono<com.mongodb.reactivestreams.client.MongoDatabase>getDatabase(ReactiveMongoDatabaseFactory factory) static Mono<com.mongodb.reactivestreams.client.MongoDatabase>getDatabase(ReactiveMongoDatabaseFactory factory, SessionSynchronization sessionSynchronization) Obtain the defaultdatabaseform the givenfactory.isTransactionActive(ReactiveMongoDatabaseFactory databaseFactory) Check if theReactiveMongoDatabaseFactoryis actually bound to aClientSessionthat has an active transaction, or if aTransactionSynchronizationhas been registered for theresourceand if the associatedClientSessionhas anactive transaction.
- 
Constructor Details- 
ReactiveMongoDatabaseUtilspublic ReactiveMongoDatabaseUtils()
 
- 
- 
Method Details- 
isTransactionActiveCheck if theReactiveMongoDatabaseFactoryis actually bound to aClientSessionthat has an active transaction, or if aTransactionSynchronizationhas been registered for theresourceand if the associatedClientSessionhas anactive transaction.- Parameters:
- databaseFactory- the resource to check transactions for. Must not be null.
- Returns:
- a Monoemitting true if the factory has an ongoing transaction.
 
- 
getDatabasepublic static Mono<com.mongodb.reactivestreams.client.MongoDatabase> getDatabase(ReactiveMongoDatabaseFactory factory) Obtain the defaultdatabaseform the givenfactoryusingnative session synchronization.
 Registers aMongoDB specific transaction synchronizationwithin the subscriberContextifsynchronization is active.- Parameters:
- factory- the- ReactiveMongoDatabaseFactoryto get the- MongoDatabasefrom.
- Returns:
- the MongoDatabasethat is potentially associated with a transactionalClientSession.
 
- 
getDatabasepublic static Mono<com.mongodb.reactivestreams.client.MongoDatabase> getDatabase(ReactiveMongoDatabaseFactory factory, SessionSynchronization sessionSynchronization) Obtain the defaultdatabaseform the givenfactory.
 Registers aMongoDB specific transaction synchronizationwithin the subscriberContextifsynchronization is active.- Parameters:
- factory- the- ReactiveMongoDatabaseFactoryto get the- MongoDatabasefrom.
- sessionSynchronization- the synchronization to use. Must not be null.
- Returns:
- the MongoDatabasethat is potentially associated with a transactionalClientSession.
 
- 
getDatabasepublic static Mono<com.mongodb.reactivestreams.client.MongoDatabase> getDatabase(String dbName, ReactiveMongoDatabaseFactory factory) Obtain thedatabasewith given name form the givenfactoryusingnative session synchronization.
 Registers aMongoDB specific transaction synchronizationwithin the subscriberContextifsynchronization is active.- Parameters:
- dbName- the name of the- MongoDatabaseto get.
- factory- the- ReactiveMongoDatabaseFactoryto get the- MongoDatabasefrom.
- Returns:
- the MongoDatabasethat is potentially associated with a transactionalClientSession.
 
- 
getDatabasepublic static Mono<com.mongodb.reactivestreams.client.MongoDatabase> getDatabase(String dbName, ReactiveMongoDatabaseFactory factory, SessionSynchronization sessionSynchronization) Obtain thedatabasewith given name form the givenfactory.
 Registers aMongoDB specific transaction synchronizationwithin the subscriberContextifsynchronization is active.- Parameters:
- dbName- the name of the- MongoDatabaseto get.
- factory- the- ReactiveMongoDatabaseFactoryto get the- MongoDatabasefrom.
- sessionSynchronization- the synchronization to use. Must not be null.
- Returns:
- the MongoDatabasethat is potentially associated with a transactionalClientSession.
 
 
-