有没有删除整个集合内容的操作?我想清空集合里面的全部内容,云函数报错如下,帮忙看下哪里问题

发布于 5 年前作者 li676577 次浏览最后编辑 5 年前来自 issues

    console.log(‘删除记录开始’)

    var aaa = await db.collection(‘high_school_exams_weektest_words’).where({

      id: _.exists(true)  //只要存在id就删除该记录

    }).remove()

    console.log(‘删除记录结束’)

报错日志如下

2 回复
hcao
hcao1 楼5 年前
const _ = db.command; 少了这行代码   控制台高级操作内置了,所以不用写
ming76
ming762 楼3 年前

_ is not define

这个是原因。