云数据库 普通查询 和聚合查询 不一样吗?
发布于 4 年前 作者 yye 9973 次浏览 来自 问答
const db = cloud.database()
const _ = db.command
const $ = db.command.aggregate
exports.main = async (event, context) => {
  return await eval(event.query)
}

上面是云数据库查询函数,传入查询字符串“query”。

当 query=“db.collection(‘books’).get()” 时能正常返回值,

当 query=“db.collection(‘books’).aggregate().group({_id:’$name’,conn:$.sum(’$con’)}).end()” 时却返回 undefined,

怎么回事?

1 回复

看看文档吧 聚合是end不是get

回到顶部