Creates a MongoDB client. You must either pass the configuration values through the parameters or set them as environment variables.

  • Parameters

    • Optionalurl: string

      (optional) the connection URL for MongoDB (e.g. mongodb://localhost:27105) Can also be set through the environment variable MONGODB_URL.

    • Optionaldb: string

      (optional) the DB Can also be set through the environment variable MONGODB_DB.

    • Optionalusername: string
    • Optionalpassword: string

      (optional) the password for the MongoDB user Can also be set through the environment variable MONGODB_PASSWORD.

    Returns Promise<Db>

    the MongoDB client