在集合中添加一批记录。
方法定义
该方法的定义如下:
insertMany(docs: object[]): Promise<MongoResult>
请求参数
该方法接收 1 个参数,其定义如下:
字段名 | 类型 | 必填 | 说明 |
---|---|---|---|
docs | Array | 是 | 待插入的数据,只能为数组。 |
示例
mpserverless.db.collection('users').insertMany([{
name: 'tom',
age: 1
},{
name: 'jerry',
age: 2
}])
.then(res => {})
.catch(console.error)
在文档使用中是否遇到以下问题
更多建议
匿名提交