Compare commits

..

2 Commits

Author SHA1 Message Date
0d3518d990 3.1.54 2020-10-19 16:44:28 +00:00
fbdde2268c fix(core): update 2020-10-19 16:44:28 +00:00
5 changed files with 13 additions and 12 deletions

2
package-lock.json generated
View File

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

View File

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

View File

@ -68,7 +68,7 @@ class Car extends smartdata.SmartDataDbDoc<Car, Car> {
@smartdata.svDb()
deepData = {
sodeep: 'yes'
sodeep: 'yes',
};
constructor(colorArg: string, brandArg: string) {
@ -85,8 +85,6 @@ tap.test('should save the car to the db', async () => {
const myCar2 = new Car('red', 'Volvo');
await myCar2.save();
let counter = 0;
const totalCars = 2000;
do {
@ -139,7 +137,7 @@ tap.test('expect to get instance of Car and update it', async () => {
tap.test('should be able to delete an instance of car', async () => {
const myCars = await Car.getInstances<Car>({
brand: 'Volvo',
color: 'blue'
color: 'blue',
});
console.log(myCars);
expect(myCars[0].color).to.equal('blue');

View File

@ -5,7 +5,10 @@ import { SmartdataDb } from './smartdata.classes.db';
export class CollectionFactory {
public collections: { [key: string]: SmartdataCollection<any> } = {};
public getCollection = (nameArg: string, dbArg: SmartdataDb | (() => SmartdataDb)): SmartdataCollection<any> => {
public getCollection = (
nameArg: string,
dbArg: SmartdataDb | (() => SmartdataDb)
): SmartdataCollection<any> => {
if (!this.collections[nameArg]) {
this.collections[nameArg] = (() => {
if (dbArg instanceof SmartdataDb) {
@ -18,5 +21,5 @@ export class CollectionFactory {
})();
}
return this.collections[nameArg];
}
};
}

View File

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