super(storageUri, logPrefix)
this.client = new MongoClient(this.storageUri.toString())
this.connected = false
- this.dbName =
- this.storageUri.pathname.replace(/(?:^\/)|(?:\/$)/g, '') ??
- Constants.DEFAULT_PERFORMANCE_RECORDS_DB_NAME
+ this.dbName = this.storageUri.pathname.replace(/(?:^\/)|(?:\/$)/g, '')
}
public async storePerformanceStatistics (performanceStatistics: Statistics): Promise<void> {
public async open (): Promise<void> {
try {
- if (!this.connected && this?.client != null) {
+ if (!this.connected && this.client != null) {
await this.client.connect()
this.connected = true
}
public async close (): Promise<void> {
try {
- if (this.connected && this?.client != null) {
+ if (this.connected && this.client != null) {
await this.client.close()
this.connected = false
}
}
private checkDBConnection (): void {
- if (this?.client == null) {
+ if (this.client == null) {
throw new BaseError(
`${this.logPrefix} ${this.getDBNameFromStorageType(
StorageType.MONGO_DB