云开发正则表达式

发布于 7 年前作者 yong8013209 次浏览最后编辑 7 年前来自 ask
  • 需求的场景描述(希望解决的问题)

const countResult = await db.collection(event.part).where({   

    “Part No”: db.RegExp({

      regexp: ‘M051*’,

      options: ‘i’,

    }),   

  }).count({

    success: function (res) {

      console.log(res.total)

    }

  })

为何结果把M052LDN也搜出来了?

  • 希望提供的能力
1 回复
yongzhu
yongzhu1 楼5 年前

你需要的应该是 ‘M051.*’ 吧?(有个 .)