Command.size(value: string): Command

View Markdown

Last edited on 2026-07-04

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

Update operator for specifying query filter conditions on array fields, requiring the array length to be equal to the specified value.

Parameters

value: string

Return Values

Command

Example

Find all records where the length of the tags array field is 2

const _ = db.command
db.collection('todos').where({
  places: _.size(2)
})
.get({
  success: console.log,
  fail: console.error,
})