node.js - 使用sequelize 更新字段值怎么自动+1
PHPz
PHPz 2017-04-17 16:04:21
0
1
590

使用sequelize 更新字段值怎么自动+1
比如我想更新文章的浏览人数,怎么自动更新浏览人数+1,而不用先获得当前浏览人数再去+1呢?

db.nices.update({lookcount:parseInt(req.query.lookcount)+1},{where:{id:id}}).then(function (resule) {
            console.log(resule);
            if(resule>0){`请输入代码`
                res.json({
                    code:200,
                    msg:"成功",
                    object:""
                })
            }
        })
PHPz
PHPz

学习是最好的投资!

reply all(1)
左手右手慢动作

I was struggling before...then I went directly to sequelize.literal...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template