mongodb - Find methods mango + node.js access values -


return undefined value (here user.password). don't undestand why

var usermodel = restful.model('user'); usermodel.find({email:req.params.email}, function(err, user){     if (user.length){       console.log(user); // works well. see whole object       console.log(user.password); // retuns undefined       res.render(viewpath + "accountverified", { meta: meta, success:1});     } }); 

you loading multiple records db, trying access variable array. see edited code:

var usermodel = restful.model('user'); usermodel.find({email:req.params.email}, function(err, users){     if (users.length) {       console.log(users); // works well. see whole object       console.log(users[0].password); // retuns undefined       res.render(viewpath + "accountverified", { meta: meta, success:1});     } }); 

Comments