mongodump/ts/mongodump.classes.mongodump.ts
2022-06-06 13:04:30 +02:00

23 lines
691 B
TypeScript

import * as plugins from './mongodump.plugins.js';
import { MongoDumpTarget } from './mongodump.classes.mongodumptarget.js';
export class MongoDump {
public mongoTargetObjectMap = new plugins.lik.ObjectMap<MongoDumpTarget>();
constructor() {}
public async addMongoTargetByMongoDescriptor(
descriptorArg: plugins.tsclass.database.IMongoDescriptor
) {
const mongoDumpTarget = await MongoDumpTarget.createAndInit(descriptorArg);
this.mongoTargetObjectMap.add(mongoDumpTarget);
return mongoDumpTarget;
}
public async stop() {
await this.mongoTargetObjectMap.forEach(async (mongoTargetArg) => {
await mongoTargetArg.mongoDbClient.close();
})
}
}