求助删除语句怎么写?
发布于 5 年前 作者 xiaming 8801 次浏览 来自 官方Issues

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

2 回复

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) });

const _ = db.command
db.collection('todos').where({
  progress: _.gt(60)}).get({
  success: console.log,
  fail: console.error})
回到顶部