📜  mongoose 保存后获取 id - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:15.908000             🧑  作者: Mango

代码示例2
//if you are sending an id field in req.body then mongoose will return e null _id
//to solve this just delete the _id field before running the save method
if(req.body._id === null) {
  delete req.body._id;
}