The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

ryanthtra (5) [Avatar] Offline
Important note: the schema instance methods in Listing 17.3 must be placed before the code where the model is set to the schema, or else when calling the instance method in Listing 17.5, the Node REPL will say that method "is not a function".

In brief, place the Listing 17.3 code above/before this line:

var Subscriber = exports.Subscriber = mongoose.model('Subscriber', subscriberSchema);
TheWexler (62) [Avatar] Offline
Sorry for the confusion. That's correct. I'll make sure to emphasize that schema methods should appear before the line to export. Thanks!