云开发数据库,已包含多个字符串的数组为关键字,对数据库数据进行检索,使用了
db.collection('legalTerms').where({
category: _.in(queryConten)
})
for (let index = 0; index < resKeyWord.length; index++) {
console.log('当前的keyWord是:',resKeyWord[index])
const legalTerms = db.collection('legalTerms').where({
keyWord:{
$regex:'.*'+ resKeyWord[index],
$options: 'i'
}
}).orderBy('checkNO', 'desc')
.get({
success(res) {
console.log('当前数组查询的返回值是:',res.data)
oldTest = oldTest.concat(res.data)
console.log('oldTest:',oldTest)
}
})
}
queryConten是一个数组,但是想实现的是,将数组中的每一个字符串都进行模糊查询,好像_.in没有这个功能,应该怎么办啊?
我现在想到的是使用for循环对数组每一个元素进行模糊检索,再将每一次检索结果拼接,最后输出,但是中间又发生了for循环中有异步请求,导致拼接结果不完整的问题。
请各位大神支招