Mongoose instance method is undefined Mongoose instance method is undefined mongoose mongoose

Mongoose instance method is undefined


So I finally figured out what I was doing wrong. The mongoose source code applies all defined methods inside schema.methods to the prototype of the model at the point at which the model's schema is set to the model name (mongoose.model("modelname", modelSchema)). Therefore, you must define all methods, which adds these methods to the method object of the Schema instance, before you set the model to its name. I was setting the model before defining the methods. Problem solved.