求助删除语句怎么写?

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

请问各位大神,云函数删除集合中age大于60的语句怎么写?如以下语句:where括号中应该怎么写?cloud.database().collection(‘users’).where().remove()

2 回复
chaotian
chaotian1 楼6 年前

const db = cloud.database();

const _ = db.command;

db.collection(‘users’).where({

    age: _.gt(00)

}).remove()

.then(res => { console.log(res) })

.catch(err => { console.error(err) });

taodu
taodu2 楼5 年前
const _ = db.command
db.collection('todos').where({
  progress: _.gt(60)}).get({
  success: console.log,
  fail: console.error})