user setpassword is not a function

Solutions on MaxInterview for user setpassword is not a function by the best coders in the world

showing results for - "user setpassword is not a function"
Sofie
09 Jun 2017
1    var mongoose = require('mongoose');
2    var bcrypt = require('bcryptjs');
3    var passportLocalMongoose=require("passport-local-mongoose");
4    mongoose.connect('mongodb://localhost/dataseed');
5
6    var db = mongoose.connection;
7
8    // User Schema
9    var UserSchema = mongoose.Schema({
10        username: {
11            type: String,
12            index: true
13        },
14        password: {
15            type: String
16        },
17        email: {
18            type: String
19        },
20        name: {
21            type: String
22        },
23        profileimage:{
24            type: String
25        },
26        as:{
27            type:String
28        },
29        institution:{
30            type:String
31        },
32        education:{
33            type:String
34
35        },
36        proffession:{
37            type:String
38        },
39        country:{
40            type:String
41        },
42        resetPasswordToken: String,
43        resetPasswordExpires: Date
44
45    });
46
47    UserSchema.plugin(passportLocalMongoose);
48
49    var User = module.exports = mongoose.model('User', UserSchema);
50