.where查询选择器不起作用。使用sqlite3和knex

时间:2018-10-22 02:45:46

标签: sqlite

server.get('/api/projects/:id', (req, res) => {
    const { id } = req.params;
    const projectId = { id };
    db('projects').where(projectId).first()
    .then(project => {
        if(!project){
            res.status(404)
        }
    db('actions').where({'project_id' : projectId})
    .then(actions => {
        project.actions = actions
        res.json(project)
        })
    })
    .catch(err => {
        res.send(err.message)
    })
 });

谁能告诉我为什么db中的.where查询调用“ actions”不起作用?

0 个答案:

没有答案