2024-05-28 18:45:34 +02:00
|
|
|
import * as plugins from '../plugins.js';
|
|
|
|
|
import { Cloudly } from '../classes.cloudly.js';
|
2024-04-20 12:21:41 +02:00
|
|
|
|
|
|
|
|
export class MongodbConnector {
|
|
|
|
|
// INSTANCE
|
|
|
|
|
private cloudlyRef: Cloudly;
|
2026-05-08 13:56:20 +00:00
|
|
|
public smartdataDb!: plugins.smartdata.SmartdataDb;
|
2024-04-20 12:21:41 +02:00
|
|
|
|
|
|
|
|
constructor(cloudlyRefArg: Cloudly) {
|
|
|
|
|
this.cloudlyRef = cloudlyRefArg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async init() {
|
2024-10-27 19:50:39 +01:00
|
|
|
this.smartdataDb = new plugins.smartdata.SmartdataDb(
|
2026-05-08 13:56:20 +00:00
|
|
|
this.cloudlyRef.config.data.mongoDescriptor!,
|
2024-10-27 19:50:39 +01:00
|
|
|
);
|
2024-04-20 12:21:41 +02:00
|
|
|
await this.smartdataDb.init();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async stop() {
|
|
|
|
|
await this.smartdataDb.close();
|
|
|
|
|
}
|
|
|
|
|
}
|