云开发联表查询怎么把查询到数据计数?
const _ = db.command
const $ = db.command.aggregate
var result = await db.collection('animal').aggregate()
.lookup({
from:'order',
let:{
animal:'$_id'
},
pipeline:$.pipeline().match(_.expr($.and([
$.eq(['$goods_id','$$animal']),
$.gte(['$state',1]),
$.lte(['$state',3])
]))).project({
_id:0
}).done(),
as :'percent'
}).end()
return result
怎么把percent计数 count()在这里怎么用