小程序数据库 用正则查询字符串字段/数组字段

1 2  {tags : "i1,i2,i3;a5,a6,a7"},
3  {tags : "i4,i5,i6;a9,a10,a11"}      
4  {tagsarr: ['i1','i2','i3']}

//查找 tags 字符串中 是否有 ‘a7’,并返回整条数据 

//数组也可以查找!

1 db.collection('db').where({
2   tags: db.RegExp({
3     regexp: 'a7',
4     options: 'i',
5   })
6 })

官方文档:https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/database/Database.RegExp.html

猜你喜欢

转载自www.cnblogs.com/iblackly/p/13394451.html