Advertisement
Guest User

Untitled

a guest
Dec 29th, 2016
106
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. email: "a2@a.com",
  20. password: "a222"
  21.  
  22. };
  23.  
  24. console.log(objectUser.User.validPassword());
  25.  
  26. db.find({email: "a2@a.com"}).....
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement