数据update时字段数据自加

发布于 7 年前作者 guiyingwei17911 次浏览最后编辑 7 年前来自 ask

代码:

await db.collection(‘XXXXX’).where({

opid: event.userInfo.openId,

}).update({

data: {

dlcs: dlcs + 1,

dldt: db.serverDate(),

}

})

如上红线部分,update时这样自加1是不成功的,必须要先查询后再加吗?

2 回复