The MongoDB\Driver\WriteResult class

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

MongoDB\Driver\WriteResult
final class MongoDB\Driver\WriteResult {
/* Properties */
public readonly intnull $insertedCount;
public readonly intnull $matchedCount;
public readonly intnull $modifiedCount;
public readonly intnull $deletedCount;
public readonly intnull $upsertedCount;
public readonly MongoDB\Driver\Server $server;
public readonly array $upsertedIds;
public readonly array $writeErrors;
public readonly MongoDB\Driver\WriteConcernErrornull $writeConcernError;
public readonly MongoDB\Driver\WriteConcernnull $writeConcern;
public readonly array $errorReplies;
/* Methods */
final public int getDeletedCount()
final public int getInsertedCount()
final public int getMatchedCount()
final public int getModifiedCount()
final public MongoDB\Driver\Server getServer()
final public int getUpsertedCount()
final public array getUpsertedIds()
final public MongoDB\Driver\WriteConcernErrornull getWriteConcernError()
final public array getWriteErrors()
final public bool isAcknowledged()
}

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