Не получается прочитать свойство node.js
В скрипте есть объект:
user_ = {
_id: 5fe5e5cf8c33b4183c5aa709,
profile: { name: 'a', descr: 'b' },
techProfile: { time: '1608902095352' }
}
По абсолютно непонятной мне причине я могу прочитать свойство profile, но не могу прочитать techProfile.
Выглядит это как-то так:
console.log(user_) // => { _id: 5fe5e5cf8c33b4183c5aa709, profile: { name: 'a', descr: 'b' }, techProfile: { time: '1608902095352' } }
console.log(user_.profile) // => { name: 'a', descr: 'b' }
console.log(user_.techProfile) // => undefined
При этом в браузерной среде все прекрасно работает.
Код исполняется в роуте:
router.get('/get/:id',
cors(corsOptions),
async(req, res) => {
try {
const user = await User.find({
'id': req.params.id
}, {
"profile": 1,
"techProfile": 1
});
const user_ = user[0];
const profile = user_.profile;
const techProfile = user_.techProfile;
console.log(user_)
const postedNews = await News.find({
"author.id": req.params.id
}, {
"id": 1
});
profile.postedNews = postedNews.length;
console.log(user_.techProfile)
return res.status(200).json({
profile
});
} catch (err) {
console.log(err.stack)
return res.status(500).json({
msg: config.get("msgs.statuses.500err")
});
}
}
);
Как прочитать techProfile?