diff --git a/docs/uniCloud/cf-database.md b/docs/uniCloud/cf-database.md index d023028cf5da145340a55a4068c0ad0f5ee4ef7f..b6bbb9078d44121e127cab83121a46386fa02263 100644 --- a/docs/uniCloud/cf-database.md +++ b/docs/uniCloud/cf-database.md @@ -237,12 +237,30 @@ exports.main = async (event, context) => { 方法1: collection.add(data) -示例: +参数说明 | 参数 | 类型 | 必填 | 说明 | | ---- | ------ | ---- | ---------------------------------------- | | data | object | array | 是 | {_id: '10001', 'name': 'Ben'} _id 非必填| +响应参数 + +单条插入时 + + +| 参数| 类型 | 说明 | +| ----| ------| ---------------------------------------- | +|id | String|插入记录的id | + +批量插入时 + +| 参数 | 类型 | 说明 | +| ---- | ------| ---------------------------------------- | +| inserted| Number| 插入成功条数 | +|ids | Array |批量插入所有记录的id | + +示例: + ```js // 单条插入数据 let res = await collection.add({ @@ -256,13 +274,8 @@ let res = await collection.add([{ },{ name: 'John' }]) -// res.inserted // 插入成功条数 -// res.ids // 批量插入返回的所有记录 id -// res.result // 阿里云特有,批量插入返回的所有记录 id,推荐使用ids ``` - - **Tips** - 云服务商为阿里云时,若集合不存在,调用add方法会自动创建集合 @@ -349,8 +362,6 @@ let res = await db.collection('goods').where({ | 字段 | 类型 | 必填 | 说明 | | --------- | ------- | ---- | ------------------------ | -| code | string | 否 | 状态码,操作成功则不返回 | -| message | string | 否 | 错误描述 | | total | Integer | 否 | 计数结果 | | requestId | string | 否 | 请求序列号,用于错误排查 |