Compare commits

..

2 Commits

Author SHA1 Message Date
bcd10205d3 3.1.44 2020-09-09 03:51:22 +00:00
6cab20f32d fix(core): update 2020-09-09 03:51:21 +00:00
5 changed files with 23 additions and 11 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartdata", "name": "@pushrocks/smartdata",
"version": "3.1.43", "version": "3.1.44",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartdata", "name": "@pushrocks/smartdata",
"version": "3.1.43", "version": "3.1.44",
"private": false, "private": false,
"description": "do more with data", "description": "do more with data",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",

View File

@ -80,15 +80,27 @@ tap.test('should save the car to the db', async () => {
const myCar2 = new Car('red', 'Volvo'); const myCar2 = new Car('red', 'Volvo');
await myCar2.save(); await myCar2.save();
let counter = 0;
do {
const myCar3 = new Car('red', 'Renault'); const myCar3 = new Car('red', 'Renault');
await myCar3.save(); await myCar3.save();
counter++;
} while (counter < 2000);
}); });
tap.test('expect to get instance of Car', async () => { tap.test('expect to get instance of Car', async () => {
let counter = 0;
do {
const timeStart = Date.now();
const myCars = await Car.getInstances<Car>({ const myCars = await Car.getInstances<Car>({
brand: 'Volvo', brand: 'Volvo',
}); });
expect(myCars[0].color).to.equal('red'); expect(myCars[0].color).to.equal('red');
console.log(`took ${Date.now() - timeStart}`);
counter++;
} while (counter < 2000);
}); });
tap.test('expect to get instance of Car and update it', async () => { tap.test('expect to get instance of Car and update it', async () => {

View File

@ -63,9 +63,9 @@ export class SmartdataCollection<T> {
}); });
if (!wantedCollection) { if (!wantedCollection) {
await this.smartdataDb.mongoDb.createCollection(this.collectionName); await this.smartdataDb.mongoDb.createCollection(this.collectionName);
console.log(`Successfully initiated Collection ${this.collectionName}`);
} }
this.mongoDbCollection = await this.smartdataDb.mongoDb.collection(this.collectionName); this.mongoDbCollection = this.smartdataDb.mongoDb.collection(this.collectionName);
// console.log(`Successfully initiated Collection ${this.collectionName}`);
} }
} }

View File

@ -41,7 +41,7 @@ export class SmartdataDb {
useNewUrlParser: true, useNewUrlParser: true,
useUnifiedTopology: true, useUnifiedTopology: true,
maxPoolSize: 100, maxPoolSize: 100,
maxIdleTimeMS: 10, maxIdleTimeMS: 10
}); });
this.mongoDb = this.mongoDbClient.db(this.smartdataOptions.mongoDbName); this.mongoDb = this.mongoDbClient.db(this.smartdataOptions.mongoDbName);
this.status = 'connected'; this.status = 'connected';