【发布时间】:2015-01-06 13:45:57
【问题描述】:
我对 Mongoose 有这样的问题:
MongoDB 中的对象
{
_id:1928319237192387,
componists:
{
name:'George Enescu'
}
}
猫鼬查询
var find = function(req, res, next) {
return IP.findById(req.params.id, function(err, artist) {
if(!artist) {
res.status(404).send({
status: 'Not Found'
});
} else if (!err) {
console.log(JSON.stringify(artist.componists.name));
}
}
输出:
undefined
预期输出:
George Enescu
但是记录 artist.componists 有效,回馈 {name:'George Enescu'}
【问题讨论】: