In my models/user.js file:
var mongoose = require(\'mongoose\');
var Schema = mongoose.Schema;
var userSchema = new Schema({
(define schema
I encountered this issue when tried to add a new model on the base code of this tutorial User Auth on MEAN stack. The solution is like what Ahei mentioned.
Specifically, I need to add a line require('path/to/your/model') in the end of /app_api/models/db.js which is required in the app.js. It is better to keep the consistency of the structure for the ease of development.