mongodb#connect TypeScript Examples

The following examples show how to use mongodb#connect. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Database.ts    From discord-statuspage-v2 with MIT License 6 votes vote down vote up
async connect (): Promise<void> {
    const mongo = await connect(this.opts.connectionURI, this.opts.options)
      .catch(console.error)

    if (mongo instanceof MongoClient) {
      this.db = mongo.db(this.opts.name)
      this.client = mongo
      this.connected = true
    }
  }