大网数据广告活动
PHP 语言与运行手册

The MongoDB\Driver\WriteResult class

· 52CE 我爱测

The MongoDB\Driver\WriteResult class encapsulates information about an executed MongoDB\Driver\BulkWrite and may be returned by MongoDB\Driver\Manager::executeBulkWrite().

The MongoDB\Driver\WriteResult class

(mongodb >=1.0.0)

Introduction

The MongoDB\Driver\WriteResult class encapsulates information about an executed MongoDB\Driver\BulkWrite and may be returned by MongoDB\Driver\Manager::executeBulkWrite().

Class synopsis

final class MongoDB\Driver\WriteResult {
/* Properties */
public readonly ?int $insertedCount;
public readonly ?int $matchedCount;
public readonly ?int $modifiedCount;
public readonly ?int $deletedCount;
public readonly ?int $upsertedCount;
public readonly array $upsertedIds;
public readonly array $writeErrors;
public readonly array $errorReplies;
/* Methods */
final public function getDeletedCount(): int
final public function getInsertedCount(): int
final public function getMatchedCount(): int
final public function getModifiedCount(): int
final public function getServer(): MongoDB\Driver\Server
final public function getUpsertedCount(): int
final public function getUpsertedIds(): array
final public function getWriteErrors(): array
final public function isAcknowledged(): bool
}

Properties

insertedCount

The number of documents inserted (excluding upserts), or null if the write concern did not request acknowledgement.

matchedCount

The number of documents matched by update and replace operations, or null if the write concern did not request acknowledgement.

modifiedCount

The number of documents modified by update and replace operations, or null if the write concern did not request acknowledgement or if the server did not report this information.

deletedCount

The number of documents deleted, or null if the write concern did not request acknowledgement.

upsertedCount

The number of documents upserted, or null if the write concern did not request acknowledgement.

server

The server that executed the bulk write.

upsertedIds

An array of _id values for upserted documents. Array keys will correspond to the index of the write operation from MongoDB\Driver\BulkWrite.

writeErrors

An array of MongoDB\Driver\WriteErrors for any write errors that occurred during execution.

writeConcernError

The MongoDB\Driver\WriteConcernError that occurred, or null if no write concern error occurred.

writeConcern

The MongoDB\Driver\WriteConcern used for the bulk write, or null if not available.

errorReplies

An array of error reply documents from the server.

Changelog

Version Description
PECL mongodb 2.3.0 Added public readonly properties.

Table of Contents

来源:PHP Documentation Group · 作者与贡献记录 · CC BY 3.0。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
PHP Documentation Group
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。