sql查询:
从场景中选择*,其中story_name =(从Story中选择story_name 其中cat_id =“ abc”和story_no = 1 +(从中选择complete.story_no 名称为curr.name和completion.cat_id =“ abc”)的用户
哪里
curr.name是nodejs(cookie会话)中当前登录的用户的名称
收藏集:
用户:
{
user_name: String
current_status:[
{
cat_id: number
story_no: number
}
]
}
故事:
{
story_name: String
story_no: Number
cat_id: numbber
}
在route.get中使用这种需求,其中categoryId存储“ abc”
router.get("/:categoryId/story", (req, res, next) => {
//var name=Story.find({ cat_id: req.params.categoryId }).map(function(like){return like.story_name})
// Scenario.find({ story_name:{$in: name} })
.then(
(scenarios) => res.json(scenarios),
(err) => next(err)
)
.catch((err) => next(err));
});