我无法从 mongoDb 获得结果,请参阅我的代码
//connect user
getUser = function(login, password, callback){
models.user.find({
password: global.helper.encode(password),
$or : [ {
username : login
} , {
mail : login
} ]
},function(err, result){
console.log(result)
console.log(result.username)
callback(result);
})
}
console.log(result) 返回:
[ { username: 'ant',
mail: 'aa@aa.aa',
password: '7e240de74fb1ed08fa08d38063f6a6a91462a815',
date_register: Sun, 18 Nov 2012 11:58:45 GMT,
date_login: Sun, 18 Nov 2012 11:58:45 GMT,
_id: 50a8cd75494a6db815000001,
__v: 0 } ]
和 console.log(result.username) 返回 undefined
我也尝试了 result['username'] 但我也有未定义
感谢您的帮助