showing results for - "mongoose get id after save"
Alessandro
15 Nov 2020
1n.save(function(err,room){
2  var newRoomId = room._id;
3  });
Renata
10 Jan 2018
1//if you are sending an id field in req.body then mongoose will return e null _id
2//to solve this just delete the _id field before running the save method
3if(req.body._id === null) {
4  delete req.body._id;
5}