云对象无法使用groupBy的吗?
const db = uniCloud.database();
module.exports = {
getHistoryToSteps: async function() {
const res = await db.collection('nai')
.groupBy('dateToString(add(new Date(0),date_time),"%Y-%m-%d","+0800") as desc')
.groupField('sum(flow) as title')
.orderBy('desc desc')
.limit(7)
.get();
console.log('res', res);
return res
}
}
运行的时候会报错:
db.collection(...).groupBy is not a function
1 个回复
DCloud_uniCloud_CRL
groupBy
、groupField
属于JQL语法,如果想在云对象/云函数中使用,请用uniCloud.databaseForJQL
方法。参考云函数中使用JQL