# [Command](/minigame/dev/wxcloud/reference-sdk-api/database/Command).all(values: any[]): [Command](/minigame/dev/wxcloud/reference-sdk-api/database/Command)

> 支持端：[小程序 2.8.3](/miniprogram/dev/framework/client-lib/version.md), [云函数 1.2.1](/minigame/dev/wxcloud/reference/changelog-server-sdk), [Web](/minigame/dev/wxcloud/reference/changelog-web-sdk)

数组查询操作符。用于数组字段的查询筛选条件，要求数组字段中包含给定数组的所有元素。

## 参数

### values: any[]

## 返回值

### [Command](/minigame/dev/wxcloud/reference-sdk-api/database/Command)

## 示例代码 1：普通数组

找出 tags 数组字段同时包含 cloud 和 database 的记录

```js
const _ = db.command
db.collection('todos').where({
  tags: _.all(['cloud', 'database'])
})
.get({
  success: console.log,
  fail: console.error
})
```

## 示例代码 2：对象数组

如果数组元素是对象，则可以用 `_.elemMatch` 匹配对象的部分字段

假设有字段 `places` 定义如下：

```
{
  "type": string
  "area": number
  "age": number
}
```

找出数组字段中至少同时包含一个满足 “area 大于 100 且 age 小于 2” 的元素和一个满足 “type 为 mall 且 age 大于 5” 的元素

```js
const _ = db.command
db.collection('todos').where({
  places: _.all([
    _.elemMatch({
      area: _.gt(100),
      age: _.lt(2),
    }),
    _.elemMatch({
      type: 'mall',
      age: _.gt(5),
    }),
  ]),
})
.get({
  success: console.log,
  fail: console.error,
})
```
