Command.shift(): Command

View Markdown

Last edited on 2026-07-04

Supported Platforms: Mini Program, Cloud Functions, Web

An array update operator that removes the first element from a field whose value is an array.

Return Value

Command

Example Code

const _ = db.command
db.collection('todos').doc('doc-id').update({
  data: {
    tags: _.shift()
  }
})