Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b71a238a3d | |||
| d0c7a95e16 |
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartmongo",
|
"name": "@pushrocks/smartmongo",
|
||||||
"version": "2.0.1",
|
"version": "2.0.2",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@pushrocks/smartmongo",
|
"name": "@pushrocks/smartmongo",
|
||||||
"version": "2.0.1",
|
"version": "2.0.2",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartdata": "^4.0.27",
|
"@pushrocks/smartdata": "^4.0.27",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartmongo",
|
"name": "@pushrocks/smartmongo",
|
||||||
"version": "2.0.1",
|
"version": "2.0.2",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "create a local mongodb for testing",
|
"description": "create a local mongodb for testing",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@pushrocks/smartmongo',
|
name: '@pushrocks/smartmongo',
|
||||||
version: '2.0.1',
|
version: '2.0.2',
|
||||||
description: 'create a local mongodb for testing'
|
description: 'create a local mongodb for testing'
|
||||||
}
|
}
|
||||||
|
|||||||
18
ts/index.ts
18
ts/index.ts
@@ -14,13 +14,17 @@ export class SmartMongo {
|
|||||||
public readyPromise = this._readyDeferred.promise;
|
public readyPromise = this._readyDeferred.promise;
|
||||||
public mongoReplicaSet: plugins.mongoPlugin.MongoMemoryReplSet;
|
public mongoReplicaSet: plugins.mongoPlugin.MongoMemoryReplSet;
|
||||||
|
|
||||||
constructor() {
|
constructor() {}
|
||||||
}
|
|
||||||
|
|
||||||
public async start(countArg: number = 1) {
|
public async start(countArg: number = 1) {
|
||||||
this.mongoReplicaSet = await plugins.mongoPlugin.MongoMemoryReplSet.create({ replSet: { count: countArg }, instanceOpts: [{
|
this.mongoReplicaSet = await plugins.mongoPlugin.MongoMemoryReplSet.create({
|
||||||
storageEngine: 'wiredTiger'
|
replSet: { count: countArg },
|
||||||
}]});
|
instanceOpts: [
|
||||||
|
{
|
||||||
|
storageEngine: 'wiredTiger',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
this._readyDeferred.resolve();
|
this._readyDeferred.resolve();
|
||||||
console.log(`mongoReplicaSet with ${countArg} replicas started.`);
|
console.log(`mongoReplicaSet with ${countArg} replicas started.`);
|
||||||
console.log(`@pushrocks/smartmongo version ${commitinfo.version}`);
|
console.log(`@pushrocks/smartmongo version ${commitinfo.version}`);
|
||||||
@@ -30,10 +34,10 @@ export class SmartMongo {
|
|||||||
await this.readyPromise;
|
await this.readyPromise;
|
||||||
return {
|
return {
|
||||||
mongoDbUrl: this.mongoReplicaSet.getUri(),
|
mongoDbUrl: this.mongoReplicaSet.getUri(),
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public async stop() {
|
public async stop() {
|
||||||
await this.mongoReplicaSet.stop(true);
|
await this.mongoReplicaSet.stop(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user