云函数查询数据库,能不能传递查询语句?
发布于 4 年前 作者 linwei 4420 次浏览 来自 官方Issues
//调用函数
wx.cloud.callFunction({
name: 'Share',
data: {
type: 'selectRecord',
query:"db.collection('s_log').where({log:null}).get()"
}
})

//云函数
const cloud = require('wx-server-sdk')
const db = cloud.database()
exports.main = async (event, context) => {
return await event.query
}

没有返回结果?

查询语句不能使用参数传递吗?

1 回复

你传过去的是字符串,字符串怎么运行?

回到顶部