I have a mongoose circuit and I call Model.create ().
When the catch chain after "then" I get undefined is not a function, if I just call the error function as the second parameter in "then", then I do not.
But when I call methods like Model.find, I can use "catch".
Why I can not intercept "catch" when calling Model.create
var mySchema = Mongoose.Schema({ name: String, });
Working:
KarmaModel.create({ "name": "ss, }) .then(function() { //do somthing },function()=>{ //do somthing });
Does not work:
KarmaModel.create({ "name": "ss, }) .then(function() { //do somthing }).catch(function()=>{ //do somthing });
Daniel billingham
source share