Skip to content

Commit

Permalink
feat(mongo): skip database field for inserts
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-sa committed Dec 28, 2023
1 parent 5be6966 commit 5e651c5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/mongo/src/persistence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,12 @@ export class MongoPersistence extends DatabasePersistence {
item['_id'] = ObjectId.generate();
}

//replaces references with the foreign key
// const converted = scopeSerializer.serialize(item);
insert.push(item);
const filteredItem = {};
for (const property of classSchema.getProperties()) {
if (property.isDatabaseSkipped(this.session.adapter.getName())) continue;
filteredItem[property.getName()] = item[property.getName()];
}
insert.push(filteredItem);
}

if (this.session.logger.active) this.session.logger.log('insert', classSchema.getClassName(), items.length);
Expand Down

0 comments on commit 5e651c5

Please sign in to comment.