Skip to content

Commit

Permalink
fix: doc null in post findOneAndUpdate function
Browse files Browse the repository at this point in the history
- Use `new` option in findOneAndUpdate function to return doc object
when do upsert
  • Loading branch information
Chinlinlee committed May 2, 2022
1 parent 4ae378c commit c80d5d0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions api/dicom-web/controller/STOW-RS/storeInstance.js
Original file line number Diff line number Diff line change
Expand Up @@ -508,12 +508,14 @@ async function storeDICOMJsonToDB(uidObj, saveDICOMFileResult) {
delete dicomJson.sopInstanceUID;
await Promise.all([
mongoose.model("dicom").findOneAndUpdate(query, dicomJson, {
upsert: true
upsert: true,
new: true
}),
mongoose.model("dicomStudy").findOneAndUpdate({
studyUID: uidObj.studyUID
}, dicomJson, {
upsert: true
upsert: true,
new: true
}),
mongoose.model("dicomSeries").findOneAndUpdate({
"$and": [
Expand All @@ -525,7 +527,8 @@ async function storeDICOMJsonToDB(uidObj, saveDICOMFileResult) {
}
]
}, dicomJson, {
upsert: true
upsert: true,
new: true
})
]);
} catch(e) {
Expand Down

0 comments on commit c80d5d0

Please sign in to comment.