Skip to content

Instantly share code, notes, and snippets.

@WillieYang
Last active August 3, 2017 10:18
Show Gist options
  • Select an option

  • Save WillieYang/9343d44683b9d0e3a3940a5e02e6a16d to your computer and use it in GitHub Desktop.

Select an option

Save WillieYang/9343d44683b9d0e3a3940a5e02e6a16d to your computer and use it in GitHub Desktop.
MongooseError: Schema hasn't been registered for model "Report"
// need to require the reports.js(schema file in model) in db connect file
[nodemon] restarting due to changes...
[nodemon] starting `node ./bin/www`
(node:26035) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 exit listeners added. Use emitter.setMaxListeners() to increase limit
/home/sheng/Work/smr_pjt_loct_dr/node_modules/mongoose/lib/index.js:382
throw new mongoose.Error.MissingSchemaError(name);
^
MongooseError: Schema hasn't been registered for model "Report".
Use mongoose.model(name, schema)
at Mongoose.model (/home/sheng/Work/smr_pjt_loct_dr/node_modules/mongoose/lib/index.js:382:13)
at Object.<anonymous> (/home/sheng/Work/smr_pjt_loct_dr/app_api/controllers/reports.js:2:23)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/sheng/Work/smr_pjt_loct_dr/app_api/routes/index.js:6:19)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
[nodemon] app crashed - waiting for file changes before starting...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment