收藏
回答

数据库更新失败,原因是什么?

代码如下:var latitude = res.latitude

        var longitude = res.longitude

        changePosition.latitude = latitude

        changePosition.longitude = longitude

        Momenry.where({

          _id:newId

        }).update({

          data:{

            hasDone:'ywc',

            changeTime:thismoment,

            changePosition:changePosition

          },success(res){

            wx.navigateTo({

              url: '/pages/memorandum/memorandum?Uname='+Uname+'&openid='+openid,

            })

          },fail(res){

            console.log(res,changePosition)

            wx.showToast({

              title: '修改失败'

            }),

            wx.redirectTo({

              url: '/pages/memorandum/memorandum?Uname='+Uname+'&openid='+openid,

            })

报错如下:Error: errCode: -502001 database request fail | errMsg: [FailedOperation] multiple write errors: [{write errors: [{Cannot create field 'latitude' in element {changePosition: ""}}]}, {<nil>}]

    at new g (VM300 WAService.js:2)

    at Function.success (VM300 WAService.js:2)

    at C (VM300 WAService.js:2)

    at Object.success (VM300 WAService.js:2)

    at B (VM300 WAService.js:2)

    at Q (VM300 WAService.js:2)

    at VM300 WAService.js:2

    at VM8 asdebug.js:1

    at T (VM8 asdebug.js:1)

    at VM8 asdebug.js:1

在我下的小程序中前边一样的写法,能够通过并获得我想要的结果,这里就不行了

回答关注问题邀请回答
收藏

1 个回答

  • zy
    zy
    2022-10-04

    你好,请问你解决了吗?是哪里的问题呀?


    2022-10-04
    有用
    回复
登录 后发表内容