收藏
回答

求助删除语句怎么写?

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

回答关注问题邀请回答
收藏

2 个回答

  • 罗梅光
    罗梅光
    2019-09-12

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


    2019-09-12
    有用
    回复 1
    • 枫丹
      枫丹
      2019-09-13
      谢谢,太感谢您了!
      2019-09-13
      回复
  • 阿客
    阿客
    2019-09-12
    const _ = db.command
    db.collection('todos').where({
      progress: _.gt(60)}).get({
      success: console.log,
      fail: console.error})


    2019-09-12
    有用
    回复 1
    • 枫丹
      枫丹
      2019-09-13
      谢谢,太感谢您了!
      2019-09-13
      回复
登录 后发表内容
问题标签