I am learning Backend development using node.js and mongodb.
Mongoose has a method Model.save(function(err,model))
what status code must be returned when for some reason the document could not be saved.
In terms of code:
Model.save(function(err,model){
if(err)
res.status(5xx).send(err);
if(!model) {
//executed when unable to save document IMHO correct me I am wrong
res.status(xxx).send("Unable to save the model in database");
}
});