Since: 2.1.0

final class BulkWriteCommandResult (View source)

The MongoDB\Driver\BulkWriteCommandResult class encapsulates information about an executed MongoDB\Driver\BulkWriteCommand and is returned by MongoDB\Driver\Manager::executeBulkWriteCommand().

Methods

int
getInsertedCount()

Returns the number of documents inserted

int
getMatchedCount()

Returns the number of documents selected for update

int
getModifiedCount()

Returns the number of existing documents updated

int
getUpsertedCount()

Returns the number of documents upserted

int
getDeletedCount()

Returns the number of documents deleted

Document|null
getInsertResults()

Returns verbose results for successful inserts

Document|null
getUpdateResults()

Returns verbose results for successful updates

Document|null
getDeleteResults()

Returns verbose results for successful deletes

bool
isAcknowledged()

Returns whether the write was acknowledged

Details

final int getInsertedCount()

Returns the number of documents inserted

Return Value

int

Returns the total number of documents inserted (excluding upserts) by all operations.

Exceptions

LogicException

final int getMatchedCount()

Returns the number of documents selected for update

If the update operation results in no change to the document (e.g. setting the value of a field to its current value), the matched count may be greater than the value returned by MongoDB\Driver\BulkWriteCommandResult::getModifiedCount().

Return Value

int

Returns the total number of documents selected for update by all operations.

Exceptions

LogicException

final int getModifiedCount()

Returns the number of existing documents updated

If the update operation results in no change to the document (e.g. setting the value of a field to its current value), the modified count may be less than the value returned by MongoDB\Driver\BulkWriteCommandResult::getMatchedCount().

Return Value

int

Returns the total number of existing documents updated by all operations.

Exceptions

LogicException

final int getUpsertedCount()

Returns the number of documents upserted

Return Value

int

Returns the total number of documents upserted by all operations.

Exceptions

LogicException

final int getDeletedCount()

Returns the number of documents deleted

Return Value

int

Returns the total number of documents deleted by all operations.

Exceptions

LogicException

final Document|null getInsertResults()

Returns verbose results for successful inserts

Return Value

Document|null

Returns a document containing the result of each successful insert operation, or null if verbose results were not requested. The document keys will correspond to the index of the write operation from MongoDB\Driver\BulkWriteCommand.

Exceptions

LogicException

final Document|null getUpdateResults()

Returns verbose results for successful updates

Return Value

Document|null

Returns a document containing the result of each successful update operation, or null if verbose results were not requested. The document keys will correspond to the index of the write operation from MongoDB\Driver\BulkWriteCommand.

Exceptions

LogicException

final Document|null getDeleteResults()

Returns verbose results for successful deletes

Return Value

Document|null

Returns a document containing the result of each successful delete operation, or null if verbose results were not requested. The document keys will correspond to the index of the write operation from MongoDB\Driver\BulkWriteCommand.

Exceptions

LogicException

final bool isAcknowledged()

Returns whether the write was acknowledged

If the write is acknowledged, other fields will be available on the MongoDB\Driver\BulkWriteCommandResult object.

Return Value

bool

Returns true if the write was acknowledged, and false otherwise.