总是提示:database collection not exists ,但是环境下确实有这个表呀?

发布于 7 年前作者 rengang2745 次浏览最后编辑 7 年前来自 ask

3 回复
xiaxiong
xiaxiong1 楼5 年前

db.collection(‘add’)

xiulan63
xiulan632 楼5 年前

示例:

yegang
yegang3 楼5 年前

callFunction 是调用云函数。collection是查找到集合(也就是表名)你的表名叫userInfo。那么你云函数add里面的index.js里这样写,写完后部署下云函数,至于调用就你的那样操作就好了。

// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init()
exports.main = async (event, context) => {
   return await cloud.database().collection('userInfo').get()
}