【发布时间】:2019-06-06 15:38:11
【问题描述】:
**帮我解决这个错误**
try {
return res.status(200).json({
error: false,
Posts: await Post.find({ group: groupId }).populate('group', 'name'),
});
} catch (e) {
return res.status(400).json({ error: true, message: 'Cannot fetch post' });
}
【问题讨论】:
-
你遇到了什么错误?
-
我没有从数据库中获取价值,但在终端中显示如下应用程序监听端口:3000 Mongodb running GET /api/groups/5cf63667c3aa330eb53b4704/posts 200 5490.717 ms - 28
-
并在邮递员中显示帖子值 null 如下:{“错误”:假,“帖子”:[]}