Mongoose instance .save() not working

前端 未结 7 731
情歌与酒
情歌与酒 2020-12-30 00:43

I have a problem with Mongoose and MongoDb

It is very interesting that only Model.update works and save never works and does not even fire

7条回答
  •  醉酒成梦
    2020-12-30 01:27

    I came across the same issue, turns out that instance.save() returns a promise. So all you need to do is handle the promise. Using async/await-

    await instance.save()
    

提交回复
热议问题