zennilL
zennilL
  • 发布:2020-11-02 10:50
  • 更新:2020-11-03 13:16
  • 阅读:1076

【报Bug】database 删除操作报系统错误,错误码 SYSTEM_ERROR

分类:uniCloud

产品分类: uniCloud/腾讯云

示例代码:

前端代码

addLocation() {  
    db.collection('wt_location').add({  
        address: '北京市西城区'  
    }).then((res) => {  
        console.log('res', res)  
    }).catch((err) => {  
        console.log('err', err)  
    })  
},  
removeLocation(id) {  
    db.collection('wt_location').where('_id==' + id + ' && user_id==$env.uid').remove().then((res) => {  
         console.log('删除成功', res)  
    }).catch((err) => {  
      console.log('删除失败', err)  
    })  
}

数据库

{  
  "bsonType": "object",  
  "required": [  
    "user_id",  
    "address"  
  ],  
  "permission": {  
    "read": "doc.user_id == auth.uid",  
    "create": "auth.uid != null",  
    "update": false,  
    "delete": "doc.user_id == auth.uid"  
  },  
  "properties": {  
    "_id": {  
      "description": "ID,系统自动生成"  
    },  
    "user_id": {  
      "bsonType": "string",  
      "description": "添加者id,参考uni-id-users表",  
      "forceDefaultValue": {  
        "$env": "uid"  
      }  
    },  
    "address": {  
      "bsonType": "string",  
      "description": "地址描述"  
    },  
    "create_date": {  
      "bsonType": "timestamp",  
      "description": "收藏时间"  
    }  
  }  
}

操作步骤:

使用 addLocation 添加5条记录,依次调用 removeLocation 方法

预期结果:

添加5条记录已删除

实际结果:

部分删除,其他记录继续调用remove方法报错
报错如下:
{"code":"SYSTEM_ERROR","message":"Identifier directly after number (1:6)"}

bug描述:

删除操作某些记录会出现错误码
requestId: "见机密信息"
response_data: "{"code":"SYSTEM_ERROR","message":"Identifier directly after number (1:6)"}"

2020-11-02 10:50 负责人:无 分享
已邀请:
DCloud_uniCloud_WYQ

DCloud_uniCloud_WYQ

'_id=="' + id + '" && user_id==$env.uid'
  • zennilL (作者)

    感谢答复

    2020-11-03 16:53

  • 操作起来

    请问 unicloud-db组件的where , 怎么用in条件查呢

    2021-10-09 15:35

该问题目前已经被锁定, 无法添加新回复