mongodump/ts/mongodump.classes.mongodump.ts

23 lines
691 B
TypeScript
Raw Normal View History

2022-06-05 19:04:16 +00:00
import * as plugins from './mongodump.plugins.js';
2022-06-06 11:04:30 +00:00
import { MongoDumpTarget } from './mongodump.classes.mongodumptarget.js';
2022-06-05 19:04:16 +00:00
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();
})
}
}