Error: mongoose.model is not a function
Add this line at the end:
module.exports = mongoose.model('User', UserSchema);
I downgraded my mongoose and it worked fine:
mongoose": "^4.13.12","mongoose-auto-increment": "^5.0.1",
'use strict';var mongoose = require('mongoose');var UserSchema = new mongoose.Schema({ firstName:{ type: String, required: true }, lastName:{ type: String, required: true }, email:{ type: String, required: true }, password:{ type: String, required: true }});mongoose.model('User', UserSchema);
I hope this helps someone. It took me a lot of time to figure it out.