# db.command.shift

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

Function signature:

function shift(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: _.shift()
      }
    })
  } catch(e) {
    console.error(e)
  }
}
点击咨询小助手