fix(id field now properly populated): update
This commit is contained in:
parent
c1c4a29415
commit
246e3486f0
@ -136,7 +136,10 @@ tap.test('should store a new Truck', async () => {
|
||||
const truck = new Truck('blue', 'MAN');
|
||||
await truck.save();
|
||||
const myTruck = await Truck.getInstance<Truck>({color: 'blue'});
|
||||
console.log(myTruck);
|
||||
myTruck.id = 'foo';
|
||||
await myTruck.save();
|
||||
const myTruck2 = await Truck.getInstance<Truck>({color: 'blue'});
|
||||
console.log(myTruck2);
|
||||
|
||||
});
|
||||
|
||||
|
@ -141,7 +141,7 @@ export class SmartdataCollection<T> {
|
||||
await this.init();
|
||||
await this.checkDoc(dbDocArg);
|
||||
const identifiableObject = await dbDocArg.createIdentifiableObject();
|
||||
this.mongoDbCollection.deleteOne(identifiableObject);
|
||||
await this.mongoDbCollection.deleteOne(identifiableObject);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -103,11 +103,9 @@ export class SmartDataDbDoc<T> {
|
||||
for (const item of foundDocs) {
|
||||
const newInstance = new this();
|
||||
newInstance.creationStatus = 'db';
|
||||
for (const key in item) {
|
||||
if (key !== 'id') {
|
||||
for (const key of Object.keys(item)) {
|
||||
newInstance[key] = item[key];
|
||||
}
|
||||
}
|
||||
returnArray.push(newInstance);
|
||||
}
|
||||
return returnArray;
|
||||
|
Loading…
x
Reference in New Issue
Block a user