I was trying to connect to MongoDB database using mongoose and I also defined my model but while trying to run it I got the error given below
MissingSchemaError: Schema hasn't been registered for model "User"
here are a couple of things I tried
const mongoose = require('mongoose')const Schem = mongoose.Schemamongoose.Promise = global.Promiseconst md5 = require('md5')const validator = require('validator')const mongodbErrorHandler = require('mongoose-mongodb-erros')const passportalocalMongoose = require ('passport-local-mongoose')const userSchema = new Schema ({username: { type:string, unique: true},password:{ type:string},module.exports = mongoose.model('User', userSchema)})`