Skip to content

Commit

Permalink
fix: resource.meta incorrect after updating
Browse files Browse the repository at this point in the history
  • Loading branch information
Chinlinlee committed Jan 14, 2022
1 parent 095efb7 commit 9439334
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion FHIR-mongoose-Models-Generator/resourceGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ function generateResourceSchema (type) {
${type}Schema.pre('findOneAndUpdate' , async function (next) {
const docToUpdate = await this.model.findOne(this.getFilter());
let version = Number(docToUpdate.meta.versionId);
this._update.$set.meta = {};
this._update.$set.meta = docToUpdate.meta;
this._update.$set.meta.versionId = String(version+1);
this._update.$set.meta.lastUpdated = new Date();
return next();
Expand Down

0 comments on commit 9439334

Please sign in to comment.