interface DatabaseContract {
    manager: ConnectionManagerContract;
    primaryConnectionName: string;
    connection(connectionName?): ConnectionContract;
    transaction<TResult>(handler, options?): Promise<TResult>;
}

Properties

Connection manager.

primaryConnectionName: string

Name of the primary connection defined inside config/mongodb.ts.

Methods

  • Shortcut to Database.connection().transaction()

    Type Parameters

    • TResult

    Parameters

    • handler: ((client, db) => Promise<TResult>)
        • (client, db): Promise<TResult>
        • Parameters

          • client: ClientSession
          • db: Db

          Returns Promise<TResult>

    • Optional options: TransactionOptions

    Returns Promise<TResult>