关于_inc(值) 数据库自增 这个里面的值不能用变量吗?
js:
check(){
const dc = db.command
db.collection('ruku').where({
goods_name:this.data.goodList,
store:this.data.storeList
}).get().then(res=>{
console.log(res)
db.collection('ruku').doc(res.data[0]._id).update({
data:{
goods_num:dc.inc(this.data.count)
},
}).then(ress=>{
console.log(ress)
})
})
},
控制台:Error: errCode: -502001 database request fail | errMsg: [FailedOperation] multiple write errors: [{write errors: [{Cannot increment with non-numeric argument: {goods_num: "15325"}}]}, {<nil>}]
at new t (WASubContext.js?t=wechat&s=1650450834060&v=2.14.1:17)
at Function.success (WASubContext.js?t=wechat&s=1650450834060&v=2.14.1:17)
at d (WASubContext.js?t=wechat&s=1650450834060&v=2.14.1:2)
at Object.success (WASubContext.js?t=wechat&s=1650450834060&v=2.14.1:2)
at r (WASubContext.js?t=wechat&s=1650450834060&v=2.14.1:26)
at WASubContext.js?t=wechat&s=1650450834060&v=2.14.1:26
at b (WASubContext.js?t=wechat&s=1650450834060&v=2.14.1:26)
at WASubContext.js?t=wechat&s=1650450834060&v=2.14.1:26
at WAServiceMainContext.js:11
at VM9 asdebug.js:1(env: Windows,mp,1.05.2203251; lib: 2.14.1)
goods_num:dc.inc(parseInt(this.data.count))