【发布时间】:2018-12-18 01:30:40
【问题描述】:
我正在尝试将名字和姓氏作为全名,因为我在模型中设置
"chatBotId": String,
"firstName":String,
"lastName":String,
"contactId" : String,
"type" : String,
"userId":String,
"BotResponseBlocked": Boolean
}
);
chatUserSchema.virtual('fullName').get(function(){
return this.firstName+' '+ this.lastName;
})
但我的查询没有返回全名。
chatUsersModel.find({chatBotId:chatBotId},{'_id':0,'userId':1, 'firstName':1, 'lastName':1}).lean().
exec((err,result)=>{
callback(result);
})
【问题讨论】:
标签: node.js mongodb mongoose mongodb-query aggregation-framework