These are chat archives for Automattic/mongoose

16th
Jun 2016
Jan Koppe
@JanKoppe
Jun 16 2016 08:05
Hey, trying to add a static function to my model. If i call this.Update inside the function, it returns a TypeError, this.Update is not defined. What's going wrong there? can't see a difference from my code to the documentation. Running in node 6.2
Mikołaj Stolarski
@grimor
Jun 16 2016 08:06
It's static method so it need be called from Model consturctor object ex. Model.Update()
to call this.Update you need add it to methods instead of statics
Jan Koppe
@JanKoppe
Jun 16 2016 08:08
Ugh, of course, now I see why. It's a instance function, not a class function. my bad. thanks!