云开发聚合查询如何模糊查找?我用match不生效
发布于 4 年前 作者 fangtang 3428 次浏览 来自 官方Issues

这边场景是这样的:

有个活动共一百人报名,查看活动的报名人详情

通过活动id查询到报名人员的id,然后关联到用户表,如果要对用户姓名查询,match无法模糊查询

db.collection('testUser').aggregate().lookup({
    from: 'user',
    let: {
      test_openid: '$_openid'
    },
    pipeline: $.pipeline().match(
            // 通过openid关联
      _.expr($.eq(['$_openid''$$test_openid'])
    )).match({
           //  模糊查询不生效
      userName:db.RegExp({
        regexp: keyword,
        options: 'i'
      })
    }).done(),
    as'user'
  })
  .match({
   testId // 活动id
  }).end()
回到顶部