在API(Route)调用中,我希望有3个猫鼬查询,然后将结果组合成一个响应json。
查询
student
.countDocuments
(
{}
)
.then(stundentNumber => {
return stundentNumber
})
teacher
.countDocuments
(
{}
)
.then(teacherNumber => {
return teacherNumber;
})
staff
.countDocuments
(
{}
)
.then(staffNumber => {
return staffNumber;
});
期望的回应
res.json({
teacher: teacherNumber,
student: stundentNumber,
staff: staffNumber
});
如何使用nodejs/猫鼬来完成
LEATH
慕盖茨4494581
相关分类