From ac5ce0346bf041fda454f17e266a0ef3d1cc3709 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Thu, 9 Jun 2022 00:18:05 +0200 Subject: [PATCH] fix(core): update --- ts/00_commitinfo_data.ts | 2 +- ts/index.ts | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 8b96564..df8e2a6 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -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' } diff --git a/ts/index.ts b/ts/index.ts index 0411ae6..aa4f9b8 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -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 { 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());