const dbJQL = uniCloud.databaseForJQL({
clientInfo: this.getClientInfo()
})
const collection = dbJQL.collection('uni-id-users')
const result = await collection.get({
getCount: true
})
uni-id-users
{
"bsonType": "object",
"required": [],
"permission": {
"read": true,
"create": true,
"update": true,
"delete": true
},
"properties": {
"_id": {
"description": "存储文档 ID(用户 ID),系统自动生成"
},
"avatar": {
"bsonType": "string",
"description": "头像地址",
"title": "头像地址",
"trim": "both"
},
"comment": {
"bsonType": "string",
"description": "备注",
"title": "备注",
"trim": "both"
},
"email": {
"bsonType": "string",
"description": "邮箱地址",
"format": "email",
"title": "邮箱",
"trim": "both"
},
"last_login_date": {
"bsonType": "timestamp",
"description": "最后登录时间"
},
"last_login_ip": {
"bsonType": "string",
"description": "最后登录时 IP 地址"
},
"mobile": {
"bsonType": "string",
"description": "手机号码",
"pattern": "^\+?[0-9-]{3,20}$",
"title": "手机号码",
"trim": "both"
},
"nickname": {
"bsonType": "string",
"description": "用户昵称",
"title": "昵称",
"trim": "both"
},
"password": {
"bsonType": "password",
"description": "密码,加密存储",
"title": "密码",
"trim": "both"
},
"register_date": {
"bsonType": "timestamp",
"description": "注册时间",
"forceDefaultValue": {
"$env": "now"
}
},
"roles": {
"bsonType": "array",
"description": "用户角色",
"enum": {
"collection": "uni-id-roles",
"field": "role_id as value, role_name as text"
},
"foreignKey": "uni-id-roles.role_id",
"title": "角色"
},
"status": {
"bsonType": "int",
"defaultValue": 0,
"description": "用户状态:0 正常 1 禁用 2 审核中 3 审核拒绝",
"enum": [
{
"text": "正常",
"value": 0
},
{
"text": "禁用",
"value": 1
},
{
"text": "审核中",
"value": 2
},
{
"text": "审核拒绝",
"value": 3
}
],
"title": "用户状态"
},
"token": {
"bsonType": "array",
"description": "用户token"
},
"username": {
"bsonType": "string",
"description": "用户名,不允许重复",
"title": "用户名",
"trim": "both"
}
}
}
uni-id-roles
{
"bsonType": "object",
"required": [
"role_id",
"role_name"
],
"permission": {
"read": true,
"create": true,
"update": true,
"delete": true
},
"properties": {
"_id": {
"description": "存储文档 ID,系统自动生成"
},
"comment": {
"title": "备注",
"bsonType": "string",
"description": "备注",
"trim": "both"
},
"create_date": {
"bsonType": "string",
"description": "创建时间"
},
"update_date": {
"bsonType": "string",
"description": "更新时间"
},
"role_id": {
"title": "唯一ID",
"bsonType": "string",
"description": "角色唯一标识,不可修改,不允许重复",
"trim": "both"
},
"name": {
"title": "名称",
"bsonType": "string"
},
"role_name": {
"title": "名称",
"bsonType": "string",
"description": "角色名称",
"trim": "both"
}
}
}
9***@qq.com
我是连接的云端也上传了 schema,为什么还是报TOKEN_INVALID_ANONYMOUS_USER:未能获取当前用户信息:当前用户为匿名身份
2023-08-17 17:11