db.command.pop

更新指令,对一个值为数组的字段,将数组尾部元素删除。

函数签名:

function pop(values: any[]): Command

示例代码

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('doc-id').update({
      data: {
        tags: _.pop()
      }
    })
  } catch (e) {
    console.error(e)
  }
}

个结果 ""

    没有找到相关内容 ""