# [Command](/minigame/dev/wxcloud/reference-sdk-api/database/Command).bit(object: Object): [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)

更新操作符。对字段进行位运算，可以进行 and/or/xor 运算。

## 参数

### object: Object

| 属性 | 类型 | 默认值 | 必填 | 说明 |
| ---- | ---- | ------ | -------- | ---- |
| and | number |  | 否 | 进行位与运算的整形 |
| or | number |  | 否 | 进行位或运算的整形 |
| xor | number |  | 否 | 进行位异或运算的整形 |

## 返回值

### [Command](/minigame/dev/wxcloud/reference-sdk-api/database/Command)

## 使用说明

and/or/xor 只能选其一

## 示例代码

```js
const _ = db.command
db.collection('todos').doc('doc-id').update({
  data: {
    // 假设原来是 2，则运算后是 3
    progress: _.bit({
      or: 1
    })
  }
})
```
