可以正常连接数据库,但不能查询,会报错
运行日志:
21:07:34.337 服务器连接成功 at pages/login/login.vue:54
21:07:35.728 SYSTEM_ERROR at pages/login/login.vue:59
21:07:35.731 O.split is not a function at pages/login/login.vue:60
查询数据库的代码:
const db = uniCloud.database();
const tb = db.collection('ccp-users');
if(!db && !tb)
{
uni.showToast({
icon: 'none',
position: 'bottom',
title: '无法连接到服务器'
});
console.log("无法连接到服务器")
}
else
{
console.log("服务器连接成功")
}
const res = db.collection(tb).where({'mobile':"14739117200",'password': "1"}).get().then((res)=>{
// res 为数据库查询结果
}).catch((err)=>{
console.log(err.code);
console.log(err.message);
});
为了避免是变量的问题,查询的条件已经都换成了实际的值('mobile':"14739117200",'password': "1"),还是不行,换了两个项目都这样,要怎么解决啊
1 个回复
DCloud_uniCloud_WYQ