收藏
回答

云数据库,通过db.where找到数据组特定的数据,怎么实现让该数据组另一字段自增1?

问题1:

云数据库,通过db.where找到数据组特定的数据,让该数据组另一字段自增1,怎么实现?

我尝试total_count: total_count.inc(1),以及total:db.command.inc(1),均无法实现预定功能。

我写的代码如下:

await DB.where({
     data_num: serial_num,
})
.update({
   data: {
    total_count: total_count + 1,                               
},
})
.then(res=> {
  console.log("total_count: ", total_count);
});
回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容
问题标签