SHARE
TWEET

Untitled

a guest Dec 29th, 2016 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.     email: "a2@a.com",
  20.     password: "a222"
  21.  
  22.     };
  23.  
  24. console.log(objectUser.User.validPassword());
  25.    
  26. db.find({email: "a2@a.com"}).....
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top