mongoose - Receiving "TypeError: Object #<EventEmitter> has no methods 'updateMyField'" in a post-save hook -
this relevant part of code think i'm getting error in - says
"if (this.ended && !this.hasrejectlisteners()) throw reason;
typeerror: object # has no methods 'updatemyfield'"
fieldschema .post('save', function () { var self = this; self.updatemyfield(); }); fieldschema.methods = { updatemyfield: function() { var deferred = q.defer(); // things here return deferred.promise; } };
i'm pretty confused why claims there's no method - love kind of give!
the issue post hooks require use doc access object, explained , answered in why "this" keyword different in mongoose pre-save hook versus post-save hook?.
Comments
Post a Comment