Guest User

Untitled

a guest
Dec 29th, 2016
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. var userSchema = mongoose.Schema({
  2.  
  3. local : {
  4. email : String,
  5. password : String,
  6. }
  7. });
  8.  
  9. userSchema.methods.validPassword = function(password) {
  10. user=this;
  11. return this.local.password; <---------------THIS LINE
  12. };
  13.  
  14. module.exports = mongoose.model('User', userSchema);
  15.  
  16. var User = require('./usermodel.js);
  17.  
  18. var objectUser = {
  19. password: "a222"
  20.  
  21. };
  22.  
  23. console.log(objectUser.User.validPassword());
  24.  
  25. db.find({email: "[email protected]"}).....
Advertisement
Add Comment
Please, Sign In to add comment