toknight@gmail.com
toknight@gmail.com
  • 发布:2 天前
  • 更新:2 天前
  • 阅读:19

schema permission中设置read权限使用模版字符后报错 “Error: Cannot read property 'findSet' of undefined”

分类:uniCloud

schema


// devices  
{  
  "bsonType": "object",  
  "required": [],  
  "permission": {  
    "read": "doc.user_id == auth.uid",  
    "create": false,  
    "delete": false  
  },  
  "properties": {  
    "_id": {  
      "description": "ID,系统自动生成"  
    },  
    "name": {  
      "bsonType": "string",  
      "title": "设备名称",  
      "permission": {  
        "read": true,  
        "write": "doc.user_id == auth.uid"  
      }  
    },  
    "user_id": {  
      "bsonType": "string",  
      "foreignKey": "uni-id-users._id",  
      "enum": {  
        "collection": "uni-id-users",  
        "field": "_id as value, username_name as text"  
      },  
      "permission": {  
        "read": true,  
        "write": "doc.user_id == null"  
      }  
    }  
  }  
}  

// posts  
{  
  "bsonType": "object",  
  "required": [  
    "name",  
    "type",  
    "orientation",  
    "device_id",  
    "user_id"  
  ],  
  "permission": {  
    "read": "get(`database.devices.${device_id}`).user_id == auth.uid",  
    "create": "false",  
    "update": "false",  
    "delete": "false"  
  },  
  "properties": {  
    "_id": {  
      "description": "ID,系统自动生成"  
    },  
    "name": {  
      "bsonType": "string",  
      "title": "名称",  
      "required": true  
    },  
    "qr": {  
      "bsonType": "file",  
      "title": "二维码图片",  
      "description": "二维码图片",  
      "fileMediaType": "image",  
      "fileExtName": "jpg,png"  
    },  
    "device_id": {  
      "bsonType": "string",  
      "title": "对应设备"  
    }  
  }  
}  

现在使用如下语句查询:

db.collection('posts').where('device_id="134324"').get()

云端报错

Cannot read property 'findSet' of undefined
2 天前 负责人:无 分享
已邀请:

要回复问题请先登录注册