vadimdemedes / mongorito

🍹 MongoDB ODM for Node.js apps based on Redux
1.38k stars 90 forks source link

Database connect on hold #211

Closed freeintelligence closed 6 years ago

freeintelligence commented 6 years ago

Hi.

export class Connect {
  private db: Database

  constructor() {
    this.db = new Database('localhost/database', {})
  }

  async connect(): Promise<any> {
    return await this.database.connect()
  }

  getDb(): Database {
    return this.db
  }
}

await (new Connect().connect())

This makes the connection, but leaves the application on hold, since disconnection with the database is expected.

How to make the application not to wait and close without the need to occupy "disconnect"?