Answers for "user.setPassword is not a function"

0

user.setPassword is not a function

var mongoose = require('mongoose');
    var bcrypt = require('bcryptjs');
    var passportLocalMongoose=require("passport-local-mongoose");
    mongoose.connect('mongodb://localhost/dataseed');

    var db = mongoose.connection;

    // User Schema
    var UserSchema = mongoose.Schema({
        username: {
            type: String,
            index: true
        },
        password: {
            type: String
        },
        email: {
            type: String
        },
        name: {
            type: String
        },
        profileimage:{
            type: String
        },
        as:{
            type:String
        },
        institution:{
            type:String
        },
        education:{
            type:String

        },
        proffession:{
            type:String
        },
        country:{
            type:String
        },
        resetPasswordToken: String,
        resetPasswordExpires: Date

    });

    UserSchema.plugin(passportLocalMongoose);

    var User = module.exports = mongoose.model('User', UserSchema);
Posted by: Guest on September-15-2021

Code answers related to "user.setPassword is not a function"

Code answers related to "Javascript"

Browse Popular Code Answers by Language