【微信小程序】【数据库】【聚合】group到底怎么了?

发布于 7 年前作者 yantao893 次浏览最后编辑 7 年前来自 issues
const res = await db_contract.aggregate()
  .match({
    'countrys.0':event.countryside,
    'countrys.1':db.RegExp({
      regexp: event.village,
      options: 'i',
    })
  })
  .group({
    _id: {
      finishi:'$finishi',
      installed:'$installed',
      reach:'$reach',
      apply:'$apply'
    },
    num:$.sum(1)
  })
  .end()
  .then(r=>{return {errCode:0,detail:r}})
  .catch(r=>{return r})

  return res

云函数,求大佬指点,为什么输出的组里num最大是502,数据800+;

问题找到了,录入的数据里有人打空格了

1 回复
xiulan91
xiulan911 楼5 年前

那就去空格呗