db.RegExp 可以理解为和 JS 的正则表达式完全等价,正则表达式能做的事情都可以实现(比如模糊查询)。
中文匹配的话直接在正则表达式中使用中文就好,比如下面是搜索 content 字段中含有“小程序云”的文档:
const result = await db.collection('test').where({
content: /小程序云/
}).get()
const result = await db.collection('test').where({
content: db.RegExp({
regexp: '小程序云'
})
}).get()
|
对like的支持还在规划中。