Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

mongoose save returns null id

//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;
}
 
PREVIOUS NEXT
Tagged: #mongoose #save #returns #null #id
ADD COMMENT
Topic
Name
7+3 =