Command.min(value: any): Command

View Markdown

Last edited on 2026-07-04

Supported on: Mini Program 2.8.3, Cloud Functions 1.2.1, Web

Update operator. Given a value, the update is performed only if the value is less than the current field value.

Parameters

value: any

Return Value

Command

Sample Code

If the field progress > 50, update it to 50.

const _ = db.command
db.collection('todos').doc('doc-id').update({
  data: {
    progress: _.min(50)
  }
})