# db.command.pop

Update command. Deletes the end element from an array when the value of a field is the array.

Function signature:

function pop(values: any[]): Command

Sample code

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