mongoose .save() doesn't work

前端 未结 2 2306
走了就别回头了
走了就别回头了 2021-02-20 01:12

I have those code running try to save an object into MongoDB.

The .save() never got success run. the code runnin

2条回答
  •  孤独总比滥情好
    2021-02-20 01:52

    I just ran into a similar issue in my code. For mine, I was dealing with an object within my user document. I had to run a user.markModified('object') before the user.save() to ensure the changes were saved to the database. My running theory is that Mongoose wasn't tracking items unset or removed from the database automatically

提交回复
热议问题