一。子节点的field写法:
const res3 = await db.collection(res1, res2).field('_id._value as value, name as text, _id["ws-config-brand"] as children').get()
因为 ws-config-brand 含有特殊字符 - ,所以需要用 [""] 括起来
比如,想实现分类与品牌联动的代码:
const res1 = db.collection('ws-mall-categories').where('parent_id=="" || parent_id==null').getTemp()const res2 = db.collection('ws-config-brand').field('name as text, _id as value, mall_categories_id').getTemp()const res3 = await db.collection(res1, res2).field('_id._value as value, name as text, _id["ws-config-brand"] as children').get()this.options.brand_categories = res3.result.data
检索在数组内写法:
let selectIDS = this.selectedItems() //这个返回是数组let sqlStr = selectIDS.join('","')sqlStr = '["' + sqlStr + '"]'db.collection('ws-mall-comments') .where('_id in ' + sqlStr).update({check: true,is_show: this.checkStatus == 1 ? true : false})