fix(core): update
This commit is contained in:
parent
8b6c26f45a
commit
fbdde2268c
@ -68,7 +68,7 @@ class Car extends smartdata.SmartDataDbDoc<Car, Car> {
|
|||||||
|
|
||||||
@smartdata.svDb()
|
@smartdata.svDb()
|
||||||
deepData = {
|
deepData = {
|
||||||
sodeep: 'yes'
|
sodeep: 'yes',
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(colorArg: string, brandArg: string) {
|
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');
|
const myCar2 = new Car('red', 'Volvo');
|
||||||
await myCar2.save();
|
await myCar2.save();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let counter = 0;
|
let counter = 0;
|
||||||
const totalCars = 2000;
|
const totalCars = 2000;
|
||||||
do {
|
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 () => {
|
tap.test('should be able to delete an instance of car', async () => {
|
||||||
const myCars = await Car.getInstances<Car>({
|
const myCars = await Car.getInstances<Car>({
|
||||||
brand: 'Volvo',
|
brand: 'Volvo',
|
||||||
color: 'blue'
|
color: 'blue',
|
||||||
});
|
});
|
||||||
console.log(myCars);
|
console.log(myCars);
|
||||||
expect(myCars[0].color).to.equal('blue');
|
expect(myCars[0].color).to.equal('blue');
|
||||||
|
@ -5,7 +5,10 @@ import { SmartdataDb } from './smartdata.classes.db';
|
|||||||
export class CollectionFactory {
|
export class CollectionFactory {
|
||||||
public collections: { [key: string]: SmartdataCollection<any> } = {};
|
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]) {
|
if (!this.collections[nameArg]) {
|
||||||
this.collections[nameArg] = (() => {
|
this.collections[nameArg] = (() => {
|
||||||
if (dbArg instanceof SmartdataDb) {
|
if (dbArg instanceof SmartdataDb) {
|
||||||
@ -18,5 +21,5 @@ export class CollectionFactory {
|
|||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
return this.collections[nameArg];
|
return this.collections[nameArg];
|
||||||
}
|
};
|
||||||
}
|
}
|
@ -43,7 +43,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';
|
||||||
|
Loading…
Reference in New Issue
Block a user