Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

MissingSchemaError : Schema hasn't been registered for model "User"

$
0
0

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)})`

Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>