Interface ReactiveMongoDatabaseFactory

All Superinterfaces:
CodecRegistryProvider
All Known Implementing Classes:
SimpleReactiveMongoDatabaseFactory

public interface ReactiveMongoDatabaseFactory extends CodecRegistryProvider
Interface for factories creating reactive MongoDatabase instances.
Since:
2.0
Author:
Mark Paluch, Christoph Strobl, Mathieu Ouellet
  • Method Summary

    Modifier and Type
    Method
    Description
    org.bson.codecs.configuration.CodecRegistry
    Get the underlying CodecRegistry used by the reactive MongoDB Java driver.
    org.springframework.dao.support.PersistenceExceptionTranslator
    Exposes a shared MongoExceptionTranslator.
    reactor.core.publisher.Mono<com.mongodb.reactivestreams.client.MongoDatabase>
    Creates a default MongoDatabase instance.
    reactor.core.publisher.Mono<com.mongodb.reactivestreams.client.MongoDatabase>
    Obtain a MongoDatabase instance to access the database with the given name.
    reactor.core.publisher.Mono<com.mongodb.reactivestreams.client.ClientSession>
    getSession(com.mongodb.ClientSessionOptions options)
    Obtain a Mono emitting a ClientSession for given options.
    default boolean
    Returns if the given ReactiveMongoDatabaseFactory is bound to a ClientSession that has an active transaction.
    withSession(com.mongodb.reactivestreams.client.ClientSession session)
    Obtain a ClientSession bound instance of ReactiveMongoDatabaseFactory returning MongoDatabase instances that are aware and bound to the given session.

    Methods inherited from interface org.springframework.data.mongodb.CodecRegistryProvider

    getCodecFor, hasCodecFor
  • Method Details

    • getMongoDatabase

      reactor.core.publisher.Mono<com.mongodb.reactivestreams.client.MongoDatabase> getMongoDatabase() throws org.springframework.dao.DataAccessException
      Creates a default MongoDatabase instance.
      Returns:
      never null.
      Throws:
      org.springframework.dao.DataAccessException
    • getMongoDatabase

      reactor.core.publisher.Mono<com.mongodb.reactivestreams.client.MongoDatabase> getMongoDatabase(String dbName) throws org.springframework.dao.DataAccessException
      Obtain a MongoDatabase instance to access the database with the given name.
      Parameters:
      dbName - must not be null or empty.
      Returns:
      never null.
      Throws:
      org.springframework.dao.DataAccessException
    • getExceptionTranslator

      org.springframework.dao.support.PersistenceExceptionTranslator getExceptionTranslator()
      Exposes a shared MongoExceptionTranslator.
      Returns:
      will never be null.
    • getCodecRegistry

      org.bson.codecs.configuration.CodecRegistry getCodecRegistry()
      Get the underlying CodecRegistry used by the reactive MongoDB Java driver.
      Specified by:
      getCodecRegistry in interface CodecRegistryProvider
      Returns:
      never null.
    • getSession

      reactor.core.publisher.Mono<com.mongodb.reactivestreams.client.ClientSession> getSession(com.mongodb.ClientSessionOptions options)
      Obtain a Mono emitting a ClientSession for given options.
      Parameters:
      options - must not be null.
      Returns:
      never null.
      Since:
      2.1
    • withSession

      ReactiveMongoDatabaseFactory withSession(com.mongodb.reactivestreams.client.ClientSession session)
      Obtain a ClientSession bound instance of ReactiveMongoDatabaseFactory returning MongoDatabase instances that are aware and bound to the given session.
      Parameters:
      session - must not be null.
      Returns:
      never null.
      Since:
      2.1
    • isTransactionActive

      default boolean isTransactionActive()
      Returns if the given ReactiveMongoDatabaseFactory is bound to a ClientSession that has an active transaction.
      Returns:
      true if there's an active transaction, false otherwise.
      Since:
      2.2