Currently, I'm trying to retrieve a particular property from a javascript object returned by mongoose. I can see the property when printing the whole object, but when trying to use it, I get an undefined. Here's the code:
Match.findOne({id: match.id}, function (err, match) {
console.log(match)
console.log(typeof match)
console.log(match.id)
console.log(match.winner)
})
The output of that is:
{ _id: 552c7f2925efcbc88ccc55bf,
id: 499142595,
region: 'br',
winner: 200,
championsLose: [ 25, 96, 81, 113, 63 ],
championsWin: [ 37, 238, 201, 268, 81 ]
}
object
499142595
undefined
Even though the 'winner' property is clearly there. Any ideas?
UPDATE: added more logging to the above code and results of it