提交 400fce47 编写于 作者: 雪洛's avatar 雪洛

Update cf-database.md

上级 9ac17474
......@@ -779,6 +779,20 @@ let res = await db.collection('user').where({
}
```
请注意并没有提供减法操作,如果要实现减法,也需通过inc实现。比如上述字段减1,
```js
const dbCmd = db.command
let res = await db.collection('user').where({
_id: 'my-doc-id'
}).update({
count: {
fav: dbCmd.inc(-1)
}
})
```
#### mul
更新指令。用于指示字段自乘某个值。
......@@ -819,6 +833,20 @@ let res = await db.collection('user').where({
}
```
请注意并没有提供除法操作,如果要实现除法,也需通过mul实现。比如上述字段除以10,
```js
const dbCmd = db.command
let res = await db.collection('user').where({
_id: 'my-doc-id'
}).update({
count: {
fav: dbCmd.mul(0.1)
}
})
```
#### remove
更新指令。用于表示删除某个字段。如某人删除了自己一条商品评价中的评分:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册