解释:db.RegExp从基础库2.3.2开始(wx-server-sdk从0.0.23开始),数据库支持正则表达式查询,开发者可以在查询语句中使用JavaScript原生正则对象或使用db.RegExp方法来构造正则对象然后进行字符串匹配。在查询条件中对一个字段进行正则匹配即要求该字段的值可以被给定的正则表达式匹配事例:search(e,val){const_this=thisthis.screenName=econstdb=wx.cloud.database({env:'环境ID'})const_=db.commanddb.collection('person').where(_.or([{name:db.RegExp({regexp:e,option:'i'})},{person:db.RegExp({regexp:e,option:'i'})},{location:db.RegExp({regexp:e,option:'i'})}]).and([{del:0}])).get({success:function(res){_this.list=res.data}})},上面.or中条件为或,.and条件中并列满足。

TAG标签: 微信小程序小程序微信查询

http://www.xiaochengxub.com/read-107860.html