Class MongoDbClient

  • All Implemented Interfaces:
    DbClient

    public class MongoDbClient
    extends Object
    implements DbClient
    MongoDB driver handler.
    • Method Detail

      • inTransaction

        public <U,​T extends Subscribable<U>> T inTransaction​(Function<DbTransaction,​T> executor)
        Description copied from interface: DbClient
        Execute database statements in transaction.
        Specified by:
        inTransaction in interface DbClient
        Type Parameters:
        U - the type provided by the result type
        T - statement execution result type, MUST be either a Multi or a Single, as returned by all APIs of DbClient.
        Parameters:
        executor - database statement executor, see DbExecute
        Returns:
        statement execution result
      • execute

        public <U,​T extends Subscribable<U>> T execute​(Function<DbExecute,​T> executor)
        Description copied from interface: DbClient
        Execute database statement.
        Specified by:
        execute in interface DbClient
        Type Parameters:
        U - the type provided by the result type
        T - statement execution result type, MUST be either a Multi or a Single, as returned by all APIs of DbClient
        Parameters:
        executor - database statement executor, see DbExecute
        Returns:
        statement execution result
      • dbType

        public String dbType()
        Description copied from interface: DbClient
        Type of this database provider (such as jdbc:mysql, mongoDB etc.).
        Specified by:
        dbType in interface DbClient
        Returns:
        name of the database provider
      • unwrap

        public <C> Single<C> unwrap​(Class<C> cls)
        Description copied from interface: DbClient
        Unwrap database client internals. Only database connection is supported. Any operations based on this connection are blocking. Reactive support must be implemented in user code.
        Specified by:
        unwrap in interface DbClient
        Type Parameters:
        C - target class to be unwrapped
        Parameters:
        cls - target class to be unwrapped
        Returns:
        database client internals future matching provided class.