fix(core): update

This commit is contained in:
Philipp Kunz 2022-06-09 00:18:05 +02:00
parent eabda34aca
commit ac5ce0346b
2 changed files with 13 additions and 1 deletions

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@pushrocks/smartmongo',
version: '2.0.6',
version: '2.0.7',
description: 'create a local mongodb for testing'
}

View File

@ -30,6 +30,10 @@ export class SmartMongo {
console.log(`@pushrocks/smartmongo version ${commitinfo.version}`);
}
/**
* returns a mongo descriptor for modules like
* @pushrocks/smartfile.
*/
public async getMongoDescriptor(): Promise<plugins.smartdata.IMongoDescriptor> {
await this.readyPromise;
return {
@ -38,11 +42,19 @@ export class SmartMongo {
};
}
/**
* stops the smartmongo instance
* and cleans up after itself
*/
public async stop() {
await this.mongoReplicaSet.stop();
await this.mongoReplicaSet.cleanup();
}
/**
* like stop() but allows you to actually store
* the database on disk
*/
public async stopAndDumpToDir(dirArg: string, nameFunctionArg?: (doc: any) => string, emptyDirArg = true) {
const mongodumpInstance = new plugins.mongodump.MongoDump();
const mongodumpTarget = await mongodumpInstance.addMongoTargetByMongoDescriptor(await this.getMongoDescriptor());