mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-06 12:12:42 +00:00
Merge pull request #2560 from naturalcrit/fixGoogleToMongoTransfer
Change findOneAndUpdate to FindOne and Save
This commit is contained in:
@@ -247,9 +247,9 @@ const updateBrew = async (req, res)=>{
|
|||||||
brew = saved?.toObject();
|
brew = saved?.toObject();
|
||||||
} else {
|
} else {
|
||||||
// if the brew does have a stub id, update it using the stub id as the key.
|
// if the brew does have a stub id, update it using the stub id as the key.
|
||||||
saved = await HomebrewModel.findOneAndUpdate({ _id: brew._id }, brew, {
|
brew = _.assign(await HomebrewModel.findOne({ _id: brew._id }), brew);
|
||||||
returnOriginal : false
|
saved = await brew.save()
|
||||||
}).catch(saveError);
|
.catch(saveError);
|
||||||
}
|
}
|
||||||
if(!saved) return;
|
if(!saved) return;
|
||||||
// Call and wait for afterSave to complete
|
// Call and wait for afterSave to complete
|
||||||
|
|||||||
Reference in New Issue
Block a user