【发布时间】:2021-09-04 11:18:32
【问题描述】:
我在模型中使用 findOne,它会返回响应。
const findAccount = await this.accountModel.findOne({
_id: ObjectId(param.accountId),
});
console.log(findAccount);
//The above logs the data
console.log(findAccount.role, findAccount._id);
//As for this, findAccount.role is undefined, but the findAccount._id was logged.
可能是什么原因?
【问题讨论】:
-
你能展示你的模型吗?
标签: node.js mongodb express mongoose nestjs