Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Docs 菜单
Docs 主页
/ / /
PHP 库手册
/ /

MongoDB\ClientBulkWrite::createWithCollection()

2.1版本新增

MongoDB\ClientBulkWrite::createWithCollection()

Create an instance of the MongoDB\ClientBulkWrite builder from the provided MongoDB\Collection instance. You can add write operations to the ClientBulkWrite to create a new BulkWriteCommand that the library sends to the server.

function createWithCollection(
Collection $collection,
array $options = []
): self
$collection : MongoDB\Collection
The Collection instance to set as the target for bulk write operations.
$options : array

指定所需选项的数组。

名称
类型
说明

bypassDocumentValidation

布尔

If true: the write operation ignores document level validation.

默认为 false

comment

混合

使用户可以指定任意注释来帮助通过数据库分析器currentOp 输出和日志来跟踪操作。

let

数组|对象

参数名称和值的映射。值必须是常量或不引用文档字段的封闭表达式。然后可以在聚合表达式上下文中将参数作为变量进行访问(例如 $$var)。

MongoDB 服务器 6.0 及更早版本不支持此功能。如果使用,服务器将在执行时返回异常。

ordered

布尔

If true: When a single write fails, the operation stops without performing the remaining writes and throws an exception.

If false: When a single write fails, the operation continues with the remaining writes, if any, and throws an exception.

默认为 true

verboseResults

布尔

Specifies whether to return verbose results.

默认为 false

A new ClientBulkWrite instance with an empty BulkWriteCommand specification.

MongoDB\Exception\UnsupportedException,如果所选服务器使用了选项但不支持选项(例如collationreadConcernwriteConcern)。

MongoDB\Exception\InvalidArgumentException 用于与参数或选项解析相关的错误。

MongoDB\ 驱动程序\Exception\RuntimeException 对于扩展级别的其他错误(例如连接错误)。

  • 批量写入操作指南的客户端批量写入部分

后退

MongoDB\ClientBulkWrite

在此页面上