db.command.remove

更新指令。用于表示删除某个字段。

函数签名:

function remove(): Command

示例代码

删除 style 字段:

const cloud = require('wx-server-sdk')
cloud.init()
const db = cloud.database()
const _ = db.command
exports.main = async (event, context) => {
  try {
    return await db.collection('todos').doc('todo-id').update({
      data: {
        style: _.remove()
      }
    })
  } catch(e) {
    console.error(e)
  }
}