Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SakuraMongoDbConnection

SakuraMongoDbConnection is responsible for managing connections to a MongoDB database or cluster.

Hierarchy

  • SakuraMongoDbConnection

Index

Methods

addConnection

  • addConnection(dbName: string, uri: string, options?: MongoClientOptions): void
  • Adds the parameters for a connection but doesn't actually connect to the DB. This is used to queue up connection configurations that are later used for opening connections to MongoDB with SakuraMongoDbConnection.connectAll.

    Parameters

    • dbName: string
    • uri: string
    • Optional options: MongoClientOptions

    Returns void

close

  • close(dbName: string, forceClose?: boolean): Promise<void>

closeAll

  • closeAll(): Promise<null>

connect

  • connect(dbName: string, uri: string, options?: MongoClientOptions): Promise<Db>
  • Connects to MongoDB with the supplied parameters and returns a Promise containing the newly connected Db created by MongoClient.connect.

    Parameters

    • dbName: string
    • uri: string
    • Optional options: MongoClientOptions

    Returns Promise<Db>

connectAll

  • connectAll(): Promise<Db[]>

getConnection

  • getConnection(dbName: string): object
  • Gets a connection parameter from the map tracking connections.

    Parameters

    • dbName: string

    Returns object

    • Optional options?: MongoClientOptions
    • uri: string

getConnections

  • getConnections(): Map<string, object>

getDb

  • getDb(dbName: string): Db

Generated using TypeDoc